git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #150270 from amarshall/ssh-askpass-enable

nixos/ssh: Add enableAskPassword

commit06be2a92569c240c4a6f6cbbc56dee22cfe9a211 authorJanne Heß <janne@hess.ooo> dateSat 18 Dec 2021, 20:48 (5 years ago) parent5965f06f10aea2
3 files changed+25−2
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml+10 nixos/doc/manual/release-notes/rl-2205.section.md+6 nixos/modules/programs/ssh.nix+9−2
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml+10
@@ -167,6 +167,16 @@
167167 using this default will print a warning when rebuilt.
168168 </para>
169169 </listitem>
170+ <listitem>
171+ <para>
172+ The option
173+ <link linkend="opt-services.ssh.enableAskPassword">services.ssh.enableAskPassword</link>
174+ was added, decoupling the setting of
175+ <literal>SSH_ASKPASS</literal> from
176+ <literal>services.xserver.enable</literal>. This allows easy
177+ usage in non-X11 environments, e.g. Wayland.
178+ </para>
179+ </listitem>
170180 </itemizedlist>
171181 </section>
172182</section>
nixos/doc/manual/release-notes/rl-2205.section.md+6
@@ -68,3 +68,9 @@ In addition to numerous new and upgraded packages, this release has the followin
6868
6969- The `services.unifi.openPorts` option default value of `true` is now deprecated and will be changed to `false` in 22.11.
7070 Configurations using this default will print a warning when rebuilt.
71+
72+- The option
73+ [services.ssh.enableAskPassword](#opt-services.ssh.enableAskPassword) was
74+ added, decoupling the setting of `SSH_ASKPASS` from
75+ `services.xserver.enable`. This allows easy usage in non-X11 environments,
76+ e.g. Wayland.
nixos/modules/programs/ssh.nix+9−2
@@ -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}