diff --git a/modules/programs/ssh.nix b/modules/programs/ssh.nix index f906d1bc737b..9452dd00c642 100644 --- a/modules/programs/ssh.nix +++ b/modules/programs/ssh.nix @@ -198,6 +198,16 @@ let ''; }; + 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'). + ''; + }; + checkHostIP = mkOption { type = types.bool; default = true; @@ -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