summary refs log tree commit diff
path: root/nixos/modules/system/boot/initrd-ssh.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-02-03 16:37:10 +0300
committerNikolay Amiantov <ab@fmap.me>2016-02-03 16:37:10 +0300
commit1dce7c0b82ff3d02ab2bdfef917d1dc47bb63399 (patch)
tree2d211d2e5244bf172a91799bd3b61bcbe9cbccba /nixos/modules/system/boot/initrd-ssh.nix
parentb4528a696a6ea50b98ac1919fc2da85e325cab41 (diff)
downloadnixpkgs-1dce7c0b82ff3d02ab2bdfef917d1dc47bb63399.tar
nixpkgs-1dce7c0b82ff3d02ab2bdfef917d1dc47bb63399.tar.gz
nixpkgs-1dce7c0b82ff3d02ab2bdfef917d1dc47bb63399.tar.bz2
nixpkgs-1dce7c0b82ff3d02ab2bdfef917d1dc47bb63399.tar.lz
nixpkgs-1dce7c0b82ff3d02ab2bdfef917d1dc47bb63399.tar.xz
nixpkgs-1dce7c0b82ff3d02ab2bdfef917d1dc47bb63399.tar.zst
nixpkgs-1dce7c0b82ff3d02ab2bdfef917d1dc47bb63399.zip
initrd-ssh module: don't check if network is up
We already do this in initrd-network.
Diffstat (limited to 'nixos/modules/system/boot/initrd-ssh.nix')
-rw-r--r--nixos/modules/system/boot/initrd-ssh.nix34
1 files changed, 16 insertions, 18 deletions
diff --git a/nixos/modules/system/boot/initrd-ssh.nix b/nixos/modules/system/boot/initrd-ssh.nix
index 506e42bc024..4cdc8154195 100644
--- a/nixos/modules/system/boot/initrd-ssh.nix
+++ b/nixos/modules/system/boot/initrd-ssh.nix
@@ -96,29 +96,27 @@ in
     '';
 
     boot.initrd.network.postCommands = ''
-      if [ -n "$hasNetwork" ]; then
-        mkdir /dev/pts
-        mount -t devpts devpts /dev/pts
+      mkdir /dev/pts
+      mount -t devpts devpts /dev/pts
 
-        echo '${cfg.shell}' > /etc/shells
-        echo 'root:x:0:0:root:/root:${cfg.shell}' > /etc/passwd
-        echo 'passwd: files' > /etc/nsswitch.conf
+      echo '${cfg.shell}' > /etc/shells
+      echo 'root:x:0:0:root:/root:${cfg.shell}' > /etc/passwd
+      echo 'passwd: files' > /etc/nsswitch.conf
 
-        mkdir -p /var/log
-        touch /var/log/lastlog
+      mkdir -p /var/log
+      touch /var/log/lastlog
 
-        mkdir -p /etc/dropbear
-        ${optionalString (cfg.hostRSAKey != null) "ln -s ${cfg.hostRSAKey} /etc/dropbear/dropbear_rsa_host_key"}
-        ${optionalString (cfg.hostDSSKey != null) "ln -s ${cfg.hostDSSKey} /etc/dropbear/dropbear_dss_host_key"}
-        ${optionalString (cfg.hostECDSAKey != null) "ln -s ${cfg.hostECDSAKey} /etc/dropbear/dropbear_ecdsa_host_key"}
+      mkdir -p /etc/dropbear
+      ${optionalString (cfg.hostRSAKey != null) "ln -s ${cfg.hostRSAKey} /etc/dropbear/dropbear_rsa_host_key"}
+      ${optionalString (cfg.hostDSSKey != null) "ln -s ${cfg.hostDSSKey} /etc/dropbear/dropbear_dss_host_key"}
+      ${optionalString (cfg.hostECDSAKey != null) "ln -s ${cfg.hostECDSAKey} /etc/dropbear/dropbear_ecdsa_host_key"}
 
-        mkdir -p /root/.ssh
-        ${concatStrings (map (key: ''
-          echo -n ${escapeShellArg key} >> /root/.ssh/authorized_keys
-        '') cfg.authorizedKeys)}
+      mkdir -p /root/.ssh
+      ${concatStrings (map (key: ''
+        echo -n ${escapeShellArg key} >> /root/.ssh/authorized_keys
+      '') cfg.authorizedKeys)}
 
-        dropbear -s -j -k -E -m -p ${toString cfg.port}
-      fi
+      dropbear -s -j -k -E -m -p ${toString cfg.port}
     '';
 
   };