1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-13 18:23:39 +02:00

services.gpg-agent: darwin compatibility

This commit is contained in:
Enno Richter 2023-04-03 21:19:30 +02:00
parent 6c76fb5b12
commit 9a4e705ee7

View File

@ -256,13 +256,25 @@ in {
'') cfg.sshKeys;
})
(mkIf (pkgs.stdenv.isDarwin && cfg.enableSshSupport) {
launchd.agents.gpg-agent = {
enable = true;
config = {
ProgramArguments = [ "${gpgPkg}/bin/gpgconf" "--launch" "gpg-agent" ];
RunAtLoad = true;
KeepAlive.SuccessfulExit = false;
EnvironmentVariables.GNUPGHOME = homedir;
};
};
})
# The systemd units below are direct translations of the
# descriptions in the
#
# ${gpgPkg}/share/doc/gnupg/examples/systemd-user
#
# directory.
{
(mkIf pkgs.stdenv.isLinux {
assertions = [
(hm.assertions.assertPlatform "services.gpg-agent" pkgs platforms.linux)
];
@ -300,9 +312,9 @@ in {
Install = { WantedBy = [ "sockets.target" ]; };
};
}
})
(mkIf cfg.enableSshSupport {
(mkIf (pkgs.stdenv.isLinux && cfg.enableSshSupport) {
systemd.user.sockets.gpg-agent-ssh = {
Unit = {
Description = "GnuPG cryptographic agent (ssh-agent emulation)";
@ -322,7 +334,7 @@ in {
};
})
(mkIf cfg.enableExtraSocket {
(mkIf (pkgs.stdenv.isLinux && cfg.enableExtraSocket) {
systemd.user.sockets.gpg-agent-extra = {
Unit = {
Description =