1{ lib, buildGoModule, fetchFromGitHub, fetchpatch, installShellFiles }:
2
3buildGoModule rec {
4 pname = "age";
5 version = "1.1.1";
6 vendorSha256 = "sha256-MumPdRTz840+hoisJ7ADgBhyK3n8P6URobbRJYDFkDY=";
7
8 src = fetchFromGitHub {
9 owner = "FiloSottile";
10 repo = "age";
11 rev = "v${version}";
12 sha256 = "sha256-LRxxJQLQkzoCNYGS/XBixVmYXoZ1mPHKvFicPGXYLcw=";
13 };
14
15 # Worked with the upstream to change the way test vectors were sourced from
16 # another repo at test run time, so we can run test without network access.
17 # https://github.com/FiloSottile/age/pull/476
18 #
19 # Changes landed after v1.1.1, so we'll patch this one until next release.
20 patches = [
21 # Revert "all: temporarily disable testscript tests"
22 (fetchpatch {
23 name = "0001-revert-temporarily-disabled-testscript-tests.patch";
24 url = "https://github.com/FiloSottile/age/commit/5471e05672de168766f5f11453fd324c53c264e5.patch";
25 sha256 = "sha256-F3oDhRWJqqcF9MDDWPeO9V/wUGXkmUXY87wgokUIoOk=";
26 })
27
28 # age: depend on c2sp.org/CCTV/age for TestVectors
29 (fetchpatch {
30 name = "0002-depend-on-c2sp_cctv_age__TestVectors.patch";
31 url = "https://github.com/FiloSottile/age/commit/edf7388f7731b274b055dcab3ec4006cc4961b68.patch";
32 sha256 = "sha256-CloCj/uF3cqTeCfRkV6TeYiovuDQXm1ZIklREWAot1E=";
33 })
34 ];
35
36 ldflags = [
37 "-s" "-w" "-X main.Version=${version}"
38 ];
39
40 nativeBuildInputs = [ installShellFiles ];
41
42 preInstall = ''
43 installManPage doc/*.1
44 '';
45
46 doInstallCheck = true;
47 installCheckPhase = ''
48 if [[ "$("$out/bin/${pname}" --version)" == "${version}" ]]; then
49 echo '${pname} smoke check passed'
50 else
51 echo '${pname} smoke check failed'
52 return 1
53 fi
54 '';
55
56 meta = with lib; {
57 homepage = "https://age-encryption.org/";
58 description = "Modern encryption tool with small explicit keys";
59 license = licenses.bsd3;
60 maintainers = with maintainers; [ tazjin ];
61 };
62}