nixos: Handle panic_on_fail in systemd stage 1

This commit is contained in:
Will Fancher 2022-04-17 18:27:39 -04:00
parent 58f707cf86
commit 9e8b463cce

View File

@ -504,6 +504,21 @@ in {
''systemctl --no-block switch-root /sysroot "''${NEW_INIT}"''
];
};
services.panic-on-fail = {
wantedBy = ["emergency.target"];
unitConfig = {
DefaultDependencies = false;
ConditionKernelCommandLine = [
"|boot.panic_on_fail"
"|stage1panic"
];
};
script = ''
echo c > /proc/sysrq-trigger
'';
serviceConfig.Type = "oneshot";
};
};
boot.kernelParams = lib.mkIf (config.boot.resumeDevice != "") [ "resume=${config.boot.resumeDevice}" ];