@@ -33,6 +33,13 @@ in
3333
3434 programs.ssh = {
3535
36+ enableAskPassword = mkOption {
37+ type = types.bool;
38+ default = config.services.xserver.enable;
39+ defaultText = literalExpression "config.services.xserver.enable";
40+ description = "Whether to configure SSH_ASKPASS in the environment.";
41+ };
42+
3643 askPassword = mkOption {
3744 type = types.str;
3845 default = "${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass";
@@ -287,7 +294,7 @@ in
287294 # Allow ssh-agent to ask for confirmation. This requires the
288295 # unit to know about the user's $DISPLAY (via ‘systemctl
289296 # import-environment’).
290− environment.SSH_ASKPASS = optionalString config.services.xserver.enable askPasswordWrapper;
297+ environment.SSH_ASKPASS = optionalString cfg.enableAskPassword askPasswordWrapper;
291298 environment.DISPLAY = "fake"; # required to make ssh-agent start $SSH_ASKPASS
292299 };
293300
@@ -298,7 +305,7 @@ in
298305 fi
299306 '';
300307
301− environment.variables.SSH_ASKPASS = optionalString config.services.xserver.enable askPassword;
308+ environment.variables.SSH_ASKPASS = optionalString cfg.enableAskPassword askPassword;
302309
303310 };
304311}