about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDavid McFarland <corngood@gmail.com>2023-06-30 08:04:14 -0300
committerDavid McFarland <corngood@gmail.com>2023-06-30 08:04:16 -0300
commit3d4f3068fd2df3a6268f4f5a952026932991a6f0 (patch)
tree22034811afeb8ac0086869666fd60fee57a9ad02 /nixos
parent3cf96bff20759927c99a53e66540e7301e81f1aa (diff)
nixos/gnupg: fix gpg-agent when pinentryFlavor is null
8ea644997f7d92cac129ddbfab14b33997038dae moved the configuration outside
the pinentryFlavor check, causing evaluation to fail when it was set to
null.

960a5142aa812a2df307a6fab65b25ad698e13b5 removed the upstream systemd
units, causing gpg-agent.service to be conditional on pinentryFlavor.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/programs/gnupg.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/modules/programs/gnupg.nix b/nixos/modules/programs/gnupg.nix
index 3dfc53c52612c..570b234b48187 100644
--- a/nixos/modules/programs/gnupg.nix
+++ b/nixos/modules/programs/gnupg.nix
@@ -94,12 +94,13 @@ in
   };
 
   config = mkIf cfg.agent.enable {
-    environment.etc."gnupg/gpg-agent.conf".text = ''
+    environment.etc."gnupg/gpg-agent.conf".text =
+      lib.optionalString (cfg.agent.pinentryFlavor != null) ''
       pinentry-program ${pkgs.pinentry.${cfg.agent.pinentryFlavor}}/bin/pinentry
     '';
 
     # This overrides the systemd user unit shipped with the gnupg package
-    systemd.user.services.gpg-agent = mkIf (cfg.agent.pinentryFlavor != null) {
+    systemd.user.services.gpg-agent = {
       unitConfig = {
         Description = "GnuPG cryptographic agent and passphrase cache";
         Documentation = "man:gpg-agent(1)";