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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
age-plugin-tpm,
age-plugin-se,
age-plugin-sss,
age-plugin-ledger,
age-plugin-yubikey,
age-plugin-fido2-hmac,
makeWrapper,
runCommand,
}:
buildGoModule (final: {
pname = "age";
version = "1.2.1";
src = fetchFromGitHub {
owner = "FiloSottile";
repo = "age";
rev = "v${final.version}";
hash = "sha256-9ZJdrmqBj43zSvStt0r25wjSfnvitdx3GYtM3urHcaA=";
};
vendorHash = "sha256-ilRLEV7qOBZbqzg2XQi4kt0JAb/1ftT4JmahYT0zSRU=";
ldflags = [
"-s"
"-w"
"-X main.Version=${final.version}"
];
nativeBuildInputs = [
installShellFiles
];
preInstall = ''
installManPage doc/*.1
'';
doInstallCheck = true;
installCheckPhase = ''
if [[ "$("$out/bin/${final.pname}" --version)" == "${final.version}" ]]; then
echo '${final.pname} smoke check passed'
else
echo '${final.pname} smoke check failed'
return 1
fi
'';
# plugin test is flaky, see https://github.com/FiloSottile/age/issues/517
checkFlags = [
"-skip"
"TestScript/plugin"
];
# group age plugins together
passthru.plugins = {
inherit
age-plugin-tpm
age-plugin-se
age-plugin-sss
age-plugin-ledger
age-plugin-yubikey
age-plugin-fido2-hmac
;
};
# convenience function for wrapping sops with plugins
passthru.withPlugins =
filter:
runCommand "age-${final.version}-with-plugins"
{
nativeBuildInputs = [ makeWrapper ];
}
''
makeWrapper ${lib.getBin final.finalPackage}/bin/age $out/bin/age \
--prefix PATH : "${lib.makeBinPath (filter final.passthru.plugins)}"
'';
meta = with lib; {
changelog = "https://github.com/FiloSottile/age/releases/tag/v${final.version}";
homepage = "https://age-encryption.org/";
description = "Modern encryption tool with small explicit keys";
license = licenses.bsd3;
mainProgram = "age";
maintainers = with maintainers; [ tazjin ];
};
})
|