about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2023-10-21 13:24:16 -0400
committerWill Fancher <elvishjerricco@gmail.com>2023-10-21 13:24:16 -0400
commit22325ce016eeb59be10ce964e106549ac95c1896 (patch)
tree5065c0b120e3508d73b7b624a531f9048cde7fbd /nixos/modules/system
parent7c9cc5a6e5d38010801741ac830a3f8fd667a7a0 (diff)
downloadnixlib-22325ce016eeb59be10ce964e106549ac95c1896.tar
nixlib-22325ce016eeb59be10ce964e106549ac95c1896.tar.gz
nixlib-22325ce016eeb59be10ce964e106549ac95c1896.tar.bz2
nixlib-22325ce016eeb59be10ce964e106549ac95c1896.tar.lz
nixlib-22325ce016eeb59be10ce964e106549ac95c1896.tar.xz
nixlib-22325ce016eeb59be10ce964e106549ac95c1896.tar.zst
nixlib-22325ce016eeb59be10ce964e106549ac95c1896.zip
systemd-stage-1: Support for user shells
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/initrd-ssh.nix11
1 files changed, 6 insertions, 5 deletions
diff --git a/nixos/modules/system/boot/initrd-ssh.nix b/nixos/modules/system/boot/initrd-ssh.nix
index 60c5ff62ffff..3df14030ab68 100644
--- a/nixos/modules/system/boot/initrd-ssh.nix
+++ b/nixos/modules/system/boot/initrd-ssh.nix
@@ -164,13 +164,12 @@ in
           for instructions.
         '';
       }
-
-      {
-        assertion = config.boot.initrd.systemd.enable -> cfg.shell == null;
-        message = "systemd stage 1 does not support boot.initrd.network.ssh.shell";
-      }
     ];
 
+    warnings = lib.optional (config.boot.initrd.systemd.enable -> cfg.shell != null) ''
+      Please set 'boot.initrd.systemd.users.root.shell' instead of 'boot.initrd.network.ssh.shell'
+    '';
+
     boot.initrd.extraUtilsCommands = mkIf (!config.boot.initrd.systemd.enable) ''
       copy_bin_and_libs ${package}/bin/sshd
       cp -pv ${pkgs.glibc.out}/lib/libnss_files.so.* $out/lib
@@ -235,6 +234,8 @@ in
       users.sshd = { uid = 1; group = "sshd"; };
       groups.sshd = { gid = 1; };
 
+      users.root.shell = mkIf (config.boot.initrd.network.ssh.shell != null) config.boot.initrd.network.ssh.shell;
+
       contents."/etc/ssh/authorized_keys.d/root".text =
         concatStringsSep "\n" config.boot.initrd.network.ssh.authorizedKeys;
       contents."/etc/ssh/sshd_config".text = sshdConfig;