1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-15 07:39:46 +01:00
home-manager/tests/modules/programs/gpg/mutable-keyfiles.nix
Robert Helgesson a04f37fab0
treewide: deprecate DRY_RUN_CMD and DRY_RUN_NULL
As a replacement, this adds the `run` helper function.
2024-04-10 21:27:15 +02:00

31 lines
801 B
Nix

{ config, lib, pkgs, ... }:
{
programs.gpg = {
enable = true;
publicKeys = [
{
source = builtins.toFile "key1" "key1";
trust = 1;
}
{ source = builtins.toFile "key2" "key2"; }
];
};
test.stubs.gnupg = { };
test.stubs.systemd = { }; # depends on gnupg.override
nmt.script = ''
assertFileContains activate "export GNUPGHOME='/home/hm-user/.gnupg'"
assertFileContains activate "unset GNUPGHOME QUIET_ARG keyId importTrust"
assertFileRegex activate \
'^run @gnupg@/bin/gpg \$QUIET_ARG --import /nix/store/[0-9a-z]*-key1$'
assertFileRegex activate \
'^run importTrust "/nix/store/[0-9a-z]*-key1" 1$'
assertFileRegex activate \
'^run @gnupg@/bin/gpg \$QUIET_ARG --import /nix/store/[0-9a-z]*-key2$'
'';
}