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