mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01:00
gpg-agent: add darwin default homedir tests
This commit is contained in:
parent
c255e93957
commit
4c5a83bbfa
4 changed files with 61 additions and 5 deletions
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>GNUPGHOME</key>
|
||||
<string>/home/hm-user/.gnupg</string>
|
||||
</dict>
|
||||
<key>KeepAlive</key>
|
||||
<dict>
|
||||
<key>Crashed</key>
|
||||
<true/>
|
||||
<key>SuccessfulExit</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>Label</key>
|
||||
<string>org.nix-community.home.gpg-agent</string>
|
||||
<key>ProcessType</key>
|
||||
<string>Background</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>@gpg@/bin/gpgconf</string>
|
||||
<string>--launch</string>
|
||||
<string>gpg-agent</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<false/>
|
||||
<key>Sockets</key>
|
||||
<dict>
|
||||
<key>Agent</key>
|
||||
<dict>
|
||||
<key>SockPathMode</key>
|
||||
<integer>384</integer>
|
||||
<key>SockPathName</key>
|
||||
<string>/home/hm-user/.gnupg/S.gpg-agent</string>
|
||||
<key>SockType</key>
|
||||
<string>stream</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -2,19 +2,31 @@
|
|||
|
||||
with lib;
|
||||
|
||||
mkIf pkgs.stdenv.isLinux {
|
||||
let inherit (pkgs.stdenv) isDarwin;
|
||||
in {
|
||||
config = {
|
||||
services.gpg-agent.enable = true;
|
||||
services.gpg-agent.pinentryPackage = pkgs.pinentry-gnome3;
|
||||
programs.gpg.enable = true;
|
||||
services.gpg-agent.pinentryPackage =
|
||||
if isDarwin then pkgs.pinentry_mac else pkgs.pinentry-gnome3;
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { outPath = "@gpg@"; };
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
gnupg = { };
|
||||
systemd = { }; # depends on gnupg.override
|
||||
pinentry-gnome3 = { };
|
||||
pinentry_mac = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
nmt.script = if isDarwin then ''
|
||||
serviceFile=LaunchAgents/org.nix-community.home.gpg-agent.plist
|
||||
assertFileExists "$serviceFile"
|
||||
assertFileContent "$serviceFile" ${./default-homedir-expected-agent.plist}
|
||||
configFile=home-files/.gnupg/gpg-agent.conf
|
||||
assertFileRegex $configFile "pinentry-program @pinentry_mac@/bin/dummy"
|
||||
'' else ''
|
||||
in="${config.systemd.user.sockets.gpg-agent.Socket.ListenStream}"
|
||||
if [[ $in != "%t/gnupg/S.gpg-agent" ]]
|
||||
then
|
||||
|
|
|
@ -19,7 +19,9 @@ in {
|
|||
nmt.script = if isDarwin then ''
|
||||
serviceFile=LaunchAgents/org.nix-community.home.gpg-agent.plist
|
||||
assertFileExists "$serviceFile"
|
||||
assertFileContent "$serviceFile" ${./expected-agent.plist}
|
||||
assertFileContent "$serviceFile" ${
|
||||
./override-homedir-expected-agent.plist
|
||||
}
|
||||
'' else ''
|
||||
in="${config.systemd.user.sockets.gpg-agent.Socket.ListenStream}"
|
||||
if [[ $in != "%t/gnupg/d.wp4h7ks5zxy4dodqadgpbbpz/S.gpg-agent" ]]
|
||||
|
|
Loading…
Reference in a new issue