summary refs log tree commit diff
path: root/nixos/modules/services/security/yubikey-agent.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/security/yubikey-agent.nix')
-rw-r--r--nixos/modules/services/security/yubikey-agent.nix13
1 files changed, 6 insertions, 7 deletions
diff --git a/nixos/modules/services/security/yubikey-agent.nix b/nixos/modules/services/security/yubikey-agent.nix
index ac5d7054b2b..2972c64a364 100644
--- a/nixos/modules/services/security/yubikey-agent.nix
+++ b/nixos/modules/services/security/yubikey-agent.nix
@@ -41,7 +41,7 @@ in
     };
   };
 
-  config = {
+  config = mkIf cfg.enable {
     environment.systemPackages = [ cfg.package ];
     systemd.packages = [ cfg.package ];
 
@@ -51,11 +51,10 @@ in
       path = [ pkgs.pinentry.${pinentryFlavor} ];
     };
 
-    environment.extraInit = optionalString cfg.enable
-      ''
-        if [ -z "$SSH_AUTH_SOCK" -a -n "$XDG_RUNTIME_DIR" ]; then
-          export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/yubikey-agent/yubikey-agent.sock"
-        fi
-      '';
+    environment.extraInit = ''
+      if [ -z "$SSH_AUTH_SOCK" -a -n "$XDG_RUNTIME_DIR" ]; then
+        export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/yubikey-agent/yubikey-agent.sock"
+      fi
+    '';
   };
 }