ups: init

This commit is contained in:
2025-08-18 10:10:29 -04:00
parent ef8ba6aca3
commit 0b2d28d617
2 changed files with 24 additions and 0 deletions

View File

@@ -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
View 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";
};
};
}