nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPackages,
5 buildGoModule,
6 fetchFromGitHub,
7 installShellFiles,
8}:
9
10buildGoModule rec {
11 pname = "diffoci";
12 version = "0.1.7";
13
14 src = fetchFromGitHub {
15 owner = "reproducible-containers";
16 repo = "diffoci";
17 rev = "v${version}";
18 hash = "sha256-RBMgcTUdPO12rFUY82JkubXfaGjfB4oR+UqKwumFWs0=";
19 };
20
21 vendorHash = "sha256-NqYGehd+RcspQt5gQl9XH85Ds0dw+MU8W7xH/uzNjqU=";
22
23 ldflags = [
24 "-s"
25 "-w"
26 "-X=github.com/reproducible-containers/diffoci/cmd/diffoci/version.Version=v${version}"
27 ];
28
29 nativeBuildInputs = [ installShellFiles ];
30
31 postInstall =
32 let
33 diffoci =
34 if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
35 placeholder "out"
36 else
37 buildPackages.diffoci;
38 in
39 ''
40 installShellCompletion --cmd diffoci \
41 --bash <(${diffoci}/bin/diffoci completion bash) \
42 --fish <(${diffoci}/bin/diffoci completion fish) \
43 --zsh <(${diffoci}/bin/diffoci completion zsh)
44 '';
45
46 meta = {
47 description = "Diff for Docker and OCI container images";
48 homepage = "https://github.com/reproducible-containers/diffoci/";
49 license = lib.licenses.asl20;
50 maintainers = with lib.maintainers; [ jk ];
51 mainProgram = "diffoci";
52 };
53}