|
50 | 50 | }; |
51 | 51 |
|
52 | 52 | forwardX11 = mkOption { |
53 | | - type = types.bool; |
| 53 | + type = with lib.types; nullOr bool; |
54 | 54 | default = false; |
55 | 55 | description = lib.mdDoc '' |
56 | 56 | Whether to request X11 forwarding on outgoing connections by default. |
| 57 | + If set to null, the option is not set at all. |
57 | 58 | This is useful for running graphical programs on the remote machine and have them display to your local X11 server. |
58 | 59 | Historically, this value has depended on the value used by the local sshd daemon, but there really isn't a relation between the two. |
59 | 60 | Note: there are some security risks to forwarding an X11 connection. |
|
279 | 280 | config = { |
280 | 281 |
|
281 | 282 | programs.ssh.setXAuthLocation = |
282 | | - mkDefault (config.services.xserver.enable || config.programs.ssh.forwardX11 || config.services.openssh.settings.X11Forwarding); |
| 283 | + mkDefault (config.services.xserver.enable || config.programs.ssh.forwardX11 == true || config.services.openssh.settings.X11Forwarding); |
283 | 284 |
|
284 | 285 | assertions = |
285 | | - [ { assertion = cfg.forwardX11 -> cfg.setXAuthLocation; |
| 286 | + [ { assertion = cfg.forwardX11 == true -> cfg.setXAuthLocation; |
286 | 287 | message = "cannot enable X11 forwarding without setting XAuth location"; |
287 | 288 | } |
288 | 289 | ] ++ flip mapAttrsToList cfg.knownHosts (name: data: { |
|
303 | 304 | AddressFamily ${if config.networking.enableIPv6 then "any" else "inet"} |
304 | 305 | GlobalKnownHostsFile ${concatStringsSep " " knownHostsFiles} |
305 | 306 |
|
306 | | - ${optionalString cfg.setXAuthLocation '' |
307 | | - XAuthLocation ${pkgs.xorg.xauth}/bin/xauth |
308 | | - ''} |
309 | | -
|
310 | | - ForwardX11 ${if cfg.forwardX11 then "yes" else "no"} |
| 307 | + ${optionalString cfg.setXAuthLocation "XAuthLocation ${pkgs.xorg.xauth}/bin/xauth"} |
| 308 | + ${lib.optionalString (cfg.forwardX11 != null) "ForwardX11 ${if cfg.forwardX11 then "yes" else "no"}"} |
311 | 309 |
|
312 | 310 | ${optionalString (cfg.pubkeyAcceptedKeyTypes != []) "PubkeyAcceptedKeyTypes ${concatStringsSep "," cfg.pubkeyAcceptedKeyTypes}"} |
313 | 311 | ${optionalString (cfg.hostKeyAlgorithms != []) "HostKeyAlgorithms ${concatStringsSep "," cfg.hostKeyAlgorithms}"} |
|
0 commit comments