ad93acc295
This ensures that they're gone by the time the shutdown job runs, so it doesn't have to stop them itself. * Don't respawn tasks, as it doesn't seem useful (if they fail they're likely to fail again if they're restarted). svn path=/nixos/trunk/; revision=22099
26 lines
497 B
Nix
26 lines
497 B
Nix
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
{
|
|
|
|
jobs.runlevel =
|
|
{ name = "runlevel";
|
|
|
|
startOn = "runlevel [0123456S]";
|
|
|
|
task = true;
|
|
|
|
script =
|
|
''
|
|
case "$RUNLEVEL" in
|
|
0) initctl start shutdown --no-wait MODE=poweroff;;
|
|
1) initctl start shutdown --no-wait MODE=maintenance;;
|
|
6) initctl start shutdown --no-wait MODE=reboot;;
|
|
*) echo "Unsupported runlevel: $RUNLEVEL";;
|
|
esac
|
|
'';
|
|
};
|
|
|
|
}
|