diff --git a/modules/programs/ssh.nix b/modules/programs/ssh.nix index f906d1bc737b..5f1717b25bad 100644 --- a/modules/programs/ssh.nix +++ b/modules/programs/ssh.nix @@ -355,6 +355,16 @@ in ''; }; + addKeysToAgent = mkOption { + type = types.enum [ "yes" "no" "ask" "confirm" ]; + default = "no"; + description = '' + When enabled, a private key that is used during authentication will be + added to ssh-agent if it is running (with confirmation enabled if + set to 'confirm'). + ''; + }; + compression = mkOption { default = false; type = types.bool; @@ -537,6 +547,7 @@ in ControlMaster ${cfg.controlMaster} ControlPath ${cfg.controlPath} ControlPersist ${cfg.controlPersist} + AddKeysToAgent ${cfg.addKeysToAgent} ${replaceStrings ["\n"] ["\n "] cfg.extraConfig} ''; diff --git a/tests/modules/programs/ssh/default-config-expected.conf b/tests/modules/programs/ssh/default-config-expected.conf index d205cab1e6e7..11f8bb9d8cc3 100644 --- a/tests/modules/programs/ssh/default-config-expected.conf +++ b/tests/modules/programs/ssh/default-config-expected.conf @@ -10,5 +10,6 @@ Host * ControlMaster no ControlPath ~/.ssh/master-%r@%n:%p ControlPersist no + AddKeysToAgent no