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;
|
2012-03-18 19:09:17 +01:00
|
|
|
restartIfChanged = false;
|
2010-06-08 14:48:16 +02:00
|
|
|
script = "telinit 2";
|
|
|
|
};
|
|
|
|
|
2009-11-06 22:08:06 +01:00
|
|
|
jobs.runlevel =
|
|
|
|
{ name = "runlevel";
|
|
|
|
|
|
|
|
startOn = "runlevel [0123456S]";
|
|
|
|
|
|
|
|
task = true;
|
|
|
|
|
2012-03-18 19:09:17 +01:00
|
|
|
restartIfChanged = false;
|
|
|
|
|
2009-11-06 22:08:06 +01:00
|
|
|
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;;
|
2012-03-18 19:09:17 +01:00
|
|
|
2) true;;
|
2010-06-02 18:04:08 +02:00
|
|
|
6) initctl start shutdown --no-wait MODE=reboot;;
|
2009-11-06 22:08:06 +01:00
|
|
|
*) echo "Unsupported runlevel: $RUNLEVEL";;
|
|
|
|
esac
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|