test(gnupg): add tests for gnupg agent configuration
Signed-off-by: Angel J <78835633+Iamanaws@users.noreply.github.com>
This commit is contained in:
parent
0b53d57d3a
commit
d70b24c2a8
2 changed files with 32 additions and 0 deletions
31
tests/programs-gnupg.nix
Normal file
31
tests/programs-gnupg.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
gnupg = pkgs.runCommand "gnupg-0.0.0" { } "mkdir -p $out/bin";
|
||||
in
|
||||
|
||||
{
|
||||
system.primaryUser = "test-gnupg-user";
|
||||
|
||||
programs.gnupg.package = gnupg;
|
||||
programs.gnupg.agent.enable = true;
|
||||
programs.gnupg.agent.enableSSHSupport = true;
|
||||
|
||||
test = ''
|
||||
echo >&2 "checking gnupg-agent service in ~/Library/LaunchAgents"
|
||||
grep "org.nixos.gnupg-agent" ${config.out}/user/Library/LaunchAgents/org.nixos.gnupg-agent.plist
|
||||
grep "${gnupg}/bin/gpg-connect-agent" ${config.out}/user/Library/LaunchAgents/org.nixos.gnupg-agent.plist
|
||||
|
||||
echo >&2 "checking GPG_TTY in set-environment"
|
||||
grep 'export GPG_TTY=\$(tty)' ${config.system.build.setEnvironment}
|
||||
|
||||
echo >&2 "checking SSH support in set-environment"
|
||||
grep "${gnupg}/bin/gpg-connect-agent --quiet updatestartuptty /bye" ${config.system.build.setEnvironment}
|
||||
grep "${gnupg}/bin/gpgconf --list-dirs agent-ssh-socket" ${config.system.build.setEnvironment}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue