Merge pull request #262583 from ElvishJerricco/systemd-stage-1-shells

systemd-stage-1: Support for user shells
This commit is contained in:
Will Fancher
2023-10-29 13:22:47 -04:00
committed by GitHub
2 changed files with 20 additions and 8 deletions

View File

@@ -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;