system.initrd: Enable sulogin on boot failure

This commit is contained in:
陈浩南 2024-07-03 09:58:40 +08:00
parent 76414e846e
commit 5c9774e906

View File

@ -12,22 +12,18 @@ inputs:
}; };
}; };
}; };
config = config = let inherit (inputs.config.nixos.system) initrd; in inputs.lib.mkMerge
let [
inherit (inputs.config.nixos.system) initrd; { boot.initrd.systemd.enable = true; }
inherit (inputs.lib) mkIf mkMerge; (
in mkMerge inputs.lib.mkIf (initrd.sshd.enable)
[ {
{ boot.initrd.systemd.enable = true; } boot =
(
mkIf (initrd.sshd.enable)
{ {
boot = initrd.network = { enable = true; ssh = { enable = true; hostKeys = initrd.sshd.hostKeys; }; };
{ kernelParams = [ "ip=dhcp" "boot.shell_on_fail" "systemd.setenv=SYSTEMD_SULOGIN_FORCE=1" ];
initrd.network = { enable = true; ssh = { enable = true; hostKeys = initrd.sshd.hostKeys; }; }; };
kernelParams = [ "ip=dhcp" ]; }
}; )
} ];
)
];
} }