nixpkgs/modules/system/upstart-events/runlevel.nix
Eelco Dolstra 3eac003800 * Maintain /var/log/wtmp correctly during boot/shutdown.
svn path=/nixos/branches/boot-order/; revision=22182
2010-06-08 12:48:16 +00:00

35 lines
721 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;
script = "telinit 2";
};
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
'';
};
}