diff --git a/pkgs/development/tools/go-containerregistry/default.nix b/pkgs/development/tools/go-containerregistry/default.nix index 0fcbda696619..afd91a03f8a1 100644 --- a/pkgs/development/tools/go-containerregistry/default.nix +++ b/pkgs/development/tools/go-containerregistry/default.nix @@ -1,23 +1,36 @@ { lib, buildGoModule, fetchFromGitHub }: +let bins = [ "crane" "gcrane" ]; in + buildGoModule rec { pname = "go-containerregistry"; - version = "0.4.1"; + version = "0.6.0"; src = fetchFromGitHub { owner = "google"; repo = pname; rev = "v${version}"; - hash = "sha256-3mvGHAPKDUmrQkBKwlxnF6PG0ZpZDqlM9SMkCyC5ytE="; + sha256 = "0sk3g1i4w8sh40y1ffa61ap7jsscdvnhvh09k8nznydi465csbmq"; }; vendorSha256 = null; 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 + ); + # NOTE: no tests doCheck = false; @@ -25,6 +38,6 @@ buildGoModule rec { description = "Tools for interacting with remote images and registries including crane and gcrane"; homepage = "https://github.com/google/go-containerregistry"; license = licenses.apsl20; - maintainers = with maintainers; [ yurrriq ]; + maintainers = with maintainers; [ superherointj yurrriq ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2882dabc10b3..352c05a08e0f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2885,6 +2885,7 @@ with pkgs; go-chromecast = callPackage ../applications/video/go-chromecast { }; go-containerregistry = callPackage ../development/tools/go-containerregistry { }; + inherit (go-containerregistry) crane gcrane; go-rice = callPackage ../tools/misc/go.rice {};