1{ lib, buildGoModule, fetchFromGitHub }:
2
3let bins = [ "crane" "gcrane" ]; in
4
5buildGoModule rec {
6 pname = "go-containerregistry";
7 version = "0.15.2";
8
9 src = fetchFromGitHub {
10 owner = "google";
11 repo = pname;
12 rev = "v${version}";
13 sha256 = "sha256-Bva962laaHJAHwiQAMPtOBkwqce1ww+sBGkjV1TjrwQ=";
14 };
15 vendorHash = null;
16
17 subPackages = [ "cmd/crane" "cmd/gcrane" ];
18
19 outputs = [ "out" ] ++ bins;
20
21 ldflags =
22 let t = "github.com/google/go-containerregistry"; in
23 [ "-s" "-w" "-X ${t}/cmd/crane/cmd.Version=v${version}" "-X ${t}/pkg/v1/remote/transport.Version=${version}" ];
24
25 postInstall =
26 lib.concatStringsSep "\n" (
27 map (bin: ''
28 mkdir -p ''$${bin}/bin &&
29 mv $out/bin/${bin} ''$${bin}/bin/ &&
30 ln -s ''$${bin}/bin/${bin} $out/bin/
31 '') bins
32 );
33
34 # NOTE: no tests
35 doCheck = false;
36
37 meta = with lib; {
38 description = "Tools for interacting with remote images and registries including crane and gcrane";
39 homepage = "https://github.com/google/go-containerregistry";
40 license = licenses.asl20;
41 maintainers = with maintainers; [ yurrriq ];
42 };
43}