2009-11-06 22:08:06 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
|
2010-06-08 14:48:16 +02:00
|
|
|
# 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;
|
|
|
|
script = "telinit 2";
|
|
|
|
};
|
|
|
|
|
2009-11-06 22:08:06 +01:00
|
|
|
jobs.runlevel =
|
|
|
|
{ name = "runlevel";
|
|
|
|
|
|
|
|
startOn = "runlevel [0123456S]";
|
|
|
|
|
|
|
|
task = true;
|
|
|
|
|
|
|
|
script =
|
|
|
|
''
|
|
|
|
case "$RUNLEVEL" in
|
2010-06-02 18:04:08 +02:00
|
|
|
0) initctl start shutdown --no-wait MODE=poweroff;;
|
|
|
|
1) initctl start shutdown --no-wait MODE=maintenance;;
|
|
|
|
6) initctl start shutdown --no-wait MODE=reboot;;
|
2009-11-06 22:08:06 +01:00
|
|
|
*) echo "Unsupported runlevel: $RUNLEVEL";;
|
|
|
|
esac
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|