3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/security/age/default.nix
Berk D. Demir f534a05aba age: 1.0.0 -> 1.1.1
Worked with the upstream to change how test vectors were sourced, so we
can run tests in a sandbox with no networking.
2023-01-02 08:33:02 +10:00

63 lines
1.9 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, fetchpatch, installShellFiles }:
buildGoModule rec {
pname = "age";
version = "1.1.1";
vendorSha256 = "sha256-MumPdRTz840+hoisJ7ADgBhyK3n8P6URobbRJYDFkDY=";
src = fetchFromGitHub {
owner = "FiloSottile";
repo = "age";
rev = "v${version}";
sha256 = "sha256-LRxxJQLQkzoCNYGS/XBixVmYXoZ1mPHKvFicPGXYLcw=";
};
# Worked with the upstream to change the way test vectors were sourced from
# another repo at test run time, so we can run test without network access.
# https://github.com/FiloSottile/age/pull/476
#
# Changes landed after v1.1.1, so we'll patch this one until next release.
patches = [
# Revert "all: temporarily disable testscript tests"
(fetchpatch {
name = "0001-revert-temporarily-disabled-testscript-tests.patch";
url = "https://github.com/FiloSottile/age/commit/5471e05672de168766f5f11453fd324c53c264e5.patch";
sha256 = "sha256-F3oDhRWJqqcF9MDDWPeO9V/wUGXkmUXY87wgokUIoOk=";
})
# age: depend on c2sp.org/CCTV/age for TestVectors
(fetchpatch {
name = "0002-depend-on-c2sp_cctv_age__TestVectors.patch";
url = "https://github.com/FiloSottile/age/commit/edf7388f7731b274b055dcab3ec4006cc4961b68.patch";
sha256 = "sha256-CloCj/uF3cqTeCfRkV6TeYiovuDQXm1ZIklREWAot1E=";
})
];
ldflags = [
"-s" "-w" "-X main.Version=${version}"
];
nativeBuildInputs = [ installShellFiles ];
preInstall = ''
installManPage doc/*.1
'';
doInstallCheck = true;
installCheckPhase = ''
if [[ "$("$out/bin/${pname}" --version)" == "${version}" ]]; then
echo '${pname} smoke check passed'
else
echo '${pname} smoke check failed'
return 1
fi
'';
meta = with lib; {
homepage = "https://age-encryption.org/";
description = "Modern encryption tool with small explicit keys";
license = licenses.bsd3;
maintainers = with maintainers; [ tazjin ];
};
}