/
default.nix
73 lines (64 loc) · 1.94 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, testers
, repro-get
, cacert
}:
buildGoModule rec {
pname = "repro-get";
version = "0.3.0";
src = fetchFromGitHub {
owner = "reproducible-containers";
repo = "repro-get";
rev = "v${version}";
sha256 = "sha256-2B4jNP58t+cfeHi5pICtB9+NwujRzkhl1d/cPkWlNrk=";
};
vendorHash = "sha256-GM8sKIZb2G9dBj2RoRO80hQrv8D+hHYo0O9FbBuK780=";
nativeBuildInputs = [ installShellFiles ];
# The pkg/version test requires internet access, so disable it here and run it
# in passthru.pkg-version
preCheck = ''
rm -rf pkg/version
'';
ldflags = [
"-s"
"-w"
"-X github.com/reproducible-containers/${pname}/pkg/version.Version=v${version}"
];
postInstall = ''
installShellCompletion --cmd repro-get \
--bash <($out/bin/repro-get completion bash) \
--fish <($out/bin/repro-get completion fish) \
--zsh <($out/bin/repro-get completion zsh)
'';
passthru.tests = {
"pkg-version" = repro-get.overrideAttrs (old: {
# see invalidateFetcherByDrvHash
name = "${repro-get.pname}-${builtins.unsafeDiscardStringContext (lib.substring 0 12 (baseNameOf repro-get.drvPath))}";
subPackages = [ "pkg/version" ];
installPhase = ''
rm -rf $out
touch $out
'';
preCheck = "";
outputHash = "sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=";
outputHashAlgo = "sha256";
outputHashMode = "flat";
outputs = [ "out" ];
nativeBuildInputs = old.nativeBuildInputs ++ [ cacert ];
});
version = testers.testVersion {
package = repro-get;
command = "HOME=$(mktemp -d) repro-get -v";
inherit version;
};
};
meta = with lib; {
description = "Reproducible apt/dnf/apk/pacman, with content-addressing";
homepage = "https://github.com/reproducible-containers/repro-get";
license = licenses.asl20;
maintainers = with maintainers; [ matthewcroughan ];
};
}