2024-07-01 15:47:52 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
|
2021-04-08 16:26:57 +00:00
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
let bins = [ "crane" "gcrane" ]; in
|
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
buildGoModule rec {
|
|
|
|
pname = "go-containerregistry";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.20.0";
|
2021-04-08 16:26:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
sha256 = "sha256-qImLnWDw7G4GPn+hj0gbgKwHAWQtXFdtBnEc9oxGcCw=";
|
2021-04-08 16:26:57 +00:00
|
|
|
};
|
2023-04-12 12:48:02 +00:00
|
|
|
vendorHash = null;
|
2021-04-08 16:26:57 +00:00
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
subPackages = [ "cmd/crane" "cmd/gcrane" ];
|
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
outputs = [ "out" ] ++ bins;
|
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
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}" ];
|
2021-04-08 16:26:57 +00:00
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
postInstall =
|
|
|
|
lib.concatStringsSep "\n" (
|
|
|
|
map (bin: ''
|
|
|
|
mkdir -p ''$${bin}/bin &&
|
|
|
|
mv $out/bin/${bin} ''$${bin}/bin/ &&
|
|
|
|
ln -s ''$${bin}/bin/${bin} $out/bin/
|
|
|
|
'') bins
|
2024-07-01 15:47:52 +00:00
|
|
|
) + ''
|
|
|
|
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
|
|
|
|
'';
|
2021-10-06 13:57:05 +00:00
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
# NOTE: no tests
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2021-08-08 23:34:03 +00:00
|
|
|
description = "Tools for interacting with remote images and registries including crane and gcrane";
|
2021-04-08 16:26:57 +00:00
|
|
|
homepage = "https://github.com/google/go-containerregistry";
|
2022-01-07 04:07:37 +00:00
|
|
|
license = licenses.asl20;
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ yurrriq ];
|
2021-04-08 16:26:57 +00:00
|
|
|
};
|
|
|
|
}
|