nixpkgs/modules/system/upstart-events/runlevel.nix
Eelco Dolstra 9ba5f09e44 * More tasks that shouldn't be restarted (though they're harmless).
svn path=/nixos/trunk/; revision=33238
2012-03-18 18:09:17 +00:00

39 lines
816 B
Nix

{ config, pkgs, ... }:
with pkgs.lib;
{
# After booting, go to runlevel 2. (NixOS doesn't really use
# runlevels, but this keeps wtmp happy.)
jobs.boot =
{ name = "boot";
startOn = "startup";
task = true;
restartIfChanged = false;
script = "telinit 2";
};
jobs.runlevel =
{ name = "runlevel";
startOn = "runlevel [0123456S]";
task = true;
restartIfChanged = false;
script =
''
case "$RUNLEVEL" in
0) initctl start shutdown --no-wait MODE=poweroff;;
1) initctl start shutdown --no-wait MODE=maintenance;;
2) true;;
6) initctl start shutdown --no-wait MODE=reboot;;
*) echo "Unsupported runlevel: $RUNLEVEL";;
esac
'';
};
}