nixos/sshd: Fix build if knownHosts is empty.

Introduced by 77ff279f27.

Build failure: https://headcounter.org/hydra/build/583158/nixlog/5/raw

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-11-27 19:03:41 +01:00
parent 14f09e01c1
commit 2249474632
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

View File

@ -18,10 +18,10 @@ let
knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts);
knownHostsFile = pkgs.runCommand "ssh_known_hosts" {} ''
#!${pkgs.bash}/bin/bash
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
${pkgs.gnused}/bin/sed 's/^/${concatStringsSep "," h.hostNames} /' $pubkeyfile >> "$out"
'')}
'';