Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

79 lines
1.7 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
}:
let
bins = [
"crane"
"gcrane"
];
in
buildGoModule rec {
pname = "go-containerregistry";
version = "0.20.6";
src = fetchFromGitHub {
owner = "google";
repo = "go-containerregistry";
rev = "v${version}";
sha256 = "sha256-fmn2SPmYecyKY7HMPjPKvovRS/Ez+SwDe+1maccq4Hc=";
};
vendorHash = null;
nativeBuildInputs = [ installShellFiles ];
subPackages = [
"cmd/crane"
"cmd/gcrane"
];
outputs = [ "out" ] ++ bins;
ldflags =
let
t = "github.com/google/go-containerregistry";
in
[
"-s"
"-w"
"-X ${t}/cmd/crane/cmd.Version=v${version}"
"-X ${t}/pkg/v1/remote/transport.Version=${version}"
];
postInstall =
lib.concatStringsSep "\n" (
map (bin: ''
mkdir -p ''$${bin}/bin &&
mv $out/bin/${bin} ''$${bin}/bin/ &&
ln -s ''$${bin}/bin/${bin} $out/bin/
'') bins
)
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
for cmd in crane gcrane; do
installShellCompletion --cmd "$cmd" \
--bash <($GOPATH/bin/$cmd completion bash) \
--fish <($GOPATH/bin/$cmd completion fish) \
--zsh <($GOPATH/bin/$cmd completion zsh)
done
'';
# NOTE: no tests
doCheck = false;
meta = with lib; {
description = "Tools for interacting with remote images and registries including crane and gcrane";
homepage = "https://github.com/google/go-containerregistry";
license = licenses.asl20;
mainProgram = "crane";
maintainers = with maintainers; [
yurrriq
ryan4yin
];
};
}