ups: init
This commit is contained in:
@@ -30,6 +30,8 @@
|
|||||||
./services/soulseek.nix
|
./services/soulseek.nix
|
||||||
|
|
||||||
# ./services/llama-cpp.nix
|
# ./services/llama-cpp.nix
|
||||||
|
|
||||||
|
./services/ups.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.targets = {
|
systemd.targets = {
|
||||||
|
|||||||
22
services/ups.nix
Normal file
22
services/ups.nix
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
services.apcupsd = {
|
||||||
|
enable = true;
|
||||||
|
configText = ''
|
||||||
|
UPSTYPE usb
|
||||||
|
NISIP 127.0.0.1
|
||||||
|
BATTERYLEVEL 5 # shutdown after reaching 5% battery
|
||||||
|
MINUTES 5 # shutdown if estimated runtime on battery reaches 5 minutes
|
||||||
|
'';
|
||||||
|
|
||||||
|
hooks = {
|
||||||
|
# command to run when shutdown condition is met
|
||||||
|
doshutdown = "systemctl poweroff";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user