File tree Expand file tree Collapse file tree
modules/common/programs/terminal/tools/ssh Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 # Assume standard UID 1000 for primary users, or use a default
2626 remote-user-id = "1000" ;
2727
28- forward-gpg = lib . optionalString ( config . programs . gnupg . agent . enable && remote . gpgAgent ) ''
29- RemoteForward /run/user/${ remote-user-id } /gnupg/S.gpg-agent /run/user/${ user-id } /gnupg/S.gpg-agent.extra
30- RemoteForward /run/user/${ remote-user-id } /gnupg/S.gpg-agent.ssh /run/user/${ user-id } /gnupg/S.gpg-agent.ssh
31- '' ;
32- port-expr = if remote . system == "nixos" then "Port ${ builtins . toString cfg . port } " else "" ;
28+ forward-gpg =
29+ lib . optionalString ( config . programs . gnupg . agent . enable && remote . gpgAgent )
30+ " RemoteForward /run/user/${ remote-user-id } /gnupg/S.gpg-agent /run/user/${ user-id } /gnupg/S.gpg-agent.extra\n RemoteForward /run/user/${ remote-user-id } /gnupg/S.gpg-agent.ssh /run/user/${ user-id } /gnupg/S.gpg-agent.ssh" ;
31+ port-expr = lib . optionalString ( remote . system == "nixos" ) " Port ${ builtins . toString cfg . port } " ;
3332 in
34- ''
35- Host ${ name }
36- Hostname ${ remote . hostname }
37- User ${ remote-user-name }
38- ForwardAgent yes
39- ${ port-expr }
40- ${ forward-gpg }
41- ''
33+ lib . concatStringsSep "\n " (
34+ lib . filter ( x : x != "" ) [
35+ "Host ${ name } "
36+ " Hostname ${ remote . hostname } "
37+ " User ${ remote-user-name } "
38+ " ForwardAgent yes"
39+ port-expr
40+ forward-gpg
41+ ]
42+ )
4243 ) ( builtins . attrNames other-hosts ) ;
4344in
4445{
5152 config = lib . mkIf cfg . enable {
5253 programs . ssh = {
5354 extraConfig = ''
54- ${ other-hosts-config }
55+ # Custom options from `extraConfig`, to override generated options
56+ ${ other-hosts-config } ${
57+ lib . optionalString ( cfg . extraConfig != "" ) ''
5558
56- ${ cfg . extraConfig }
59+ ${ cfg . extraConfig } ''
60+ }
5761 '' ;
5862
5963 knownHosts = lib . mapAttrs ( _ : lib . mkForce ) (
You can’t perform that action at this time.
0 commit comments