mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-16 09:53:17 +00:00
26 lines
467 B
Nix
26 lines
467 B
Nix
|
{ config, pkgs, ... }:
|
||
|
|
||
|
with pkgs.lib;
|
||
|
|
||
|
{
|
||
|
|
||
|
jobs.runlevel =
|
||
|
{ name = "runlevel";
|
||
|
|
||
|
startOn = "runlevel [0123456S]";
|
||
|
|
||
|
task = true;
|
||
|
|
||
|
script =
|
||
|
''
|
||
|
case "$RUNLEVEL" in
|
||
|
0) initctl start shutdown MODE=poweroff;;
|
||
|
1) initctl start shutdown MODE=maintenance;;
|
||
|
6) initctl start shutdown MODE=reboot;;
|
||
|
*) echo "Unsupported runlevel: $RUNLEVEL";;
|
||
|
esac
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
}
|