nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 77 lines 1.6 kB view raw
1{ 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 installShellFiles, 6}: 7 8let 9 bins = [ 10 "crane" 11 "gcrane" 12 ]; 13in 14 15buildGoModule rec { 16 pname = "go-containerregistry"; 17 version = "0.20.6"; 18 19 src = fetchFromGitHub { 20 owner = "google"; 21 repo = "go-containerregistry"; 22 rev = "v${version}"; 23 sha256 = "sha256-fmn2SPmYecyKY7HMPjPKvovRS/Ez+SwDe+1maccq4Hc="; 24 }; 25 vendorHash = null; 26 27 nativeBuildInputs = [ installShellFiles ]; 28 29 subPackages = [ 30 "cmd/crane" 31 "cmd/gcrane" 32 ]; 33 34 outputs = [ "out" ] ++ bins; 35 36 ldflags = 37 let 38 t = "github.com/google/go-containerregistry"; 39 in 40 [ 41 "-s" 42 "-w" 43 "-X ${t}/cmd/crane/cmd.Version=v${version}" 44 "-X ${t}/pkg/v1/remote/transport.Version=${version}" 45 ]; 46 47 postInstall = 48 lib.concatStringsSep "\n" ( 49 map (bin: '' 50 mkdir -p ''$${bin}/bin && 51 mv $out/bin/${bin} ''$${bin}/bin/ && 52 ln -s ''$${bin}/bin/${bin} $out/bin/ 53 '') bins 54 ) 55 + '' 56 for cmd in crane gcrane; do 57 installShellCompletion --cmd "$cmd" \ 58 --bash <($GOPATH/bin/$cmd completion bash) \ 59 --fish <($GOPATH/bin/$cmd completion fish) \ 60 --zsh <($GOPATH/bin/$cmd completion zsh) 61 done 62 ''; 63 64 # NOTE: no tests 65 doCheck = false; 66 67 meta = with lib; { 68 description = "Tools for interacting with remote images and registries including crane and gcrane"; 69 homepage = "https://github.com/google/go-containerregistry"; 70 license = licenses.asl20; 71 mainProgram = "crane"; 72 maintainers = with maintainers; [ 73 yurrriq 74 ryan4yin 75 ]; 76 }; 77}