diff options
Diffstat (limited to 'nixos/modules/services/networking/ssh/sshd.nix')
-rw-r--r-- | nixos/modules/services/networking/ssh/sshd.nix | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 4db8d1e25450..c0ad9e17c413 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -17,13 +17,11 @@ let knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts); - knownHostsFile = pkgs.runCommand "ssh_known_hosts" {} '' - touch "$out" - ${flip concatMapStrings knownHosts (h: '' - pubkeyfile=${builtins.toFile "host.pub" (if h.publicKey == null then readFile h.publicKeyFile else h.publicKey)} - ${pkgs.gnused}/bin/sed 's/^/${concatStringsSep "," h.hostNames} /' $pubkeyfile >> "$out" - '')} - ''; + knownHostsText = flip (concatMapStringsSep "\n") knownHosts + (h: + concatStringsSep "," h.hostNames + " " + + (if h.publicKey != null then h.publicKey else readFile h.publicKeyFile) + ); userOptions = { @@ -301,7 +299,7 @@ in { source = "${cfgc.package}/etc/ssh/moduli"; target = "ssh/moduli"; } - { source = knownHostsFile; + { text = knownHostsText; target = "ssh/ssh_known_hosts"; } ]; |