nixos/ups: run killpower driver as root

upsdrv starts the driver with `upsdrvctl -u root start`, but
ups-killpower invokes a bare `upsdrvctl shutdown`. Since nut
is built --with-user=nutmon, nut fails to read both /var/lib/nut
and the USB device with "insufficient permissions on everything".
The UPS is then never told to cut its outlets: it keeps draining
battery after the OS has halted, and cannot power-cycle the machine
when mains returns.

Ergo, run the shutdown as root.

(cherry picked from commit f4d444ddff)
This commit is contained in:
Jack Kelly
2026-08-14 11:10:23 -04:00
committed by github-actions[bot]
parent b708157eca
commit e5f495b69b

View File

@@ -679,7 +679,7 @@ in
environment = envVars;
serviceConfig = {
Type = "oneshot";
ExecStart = "${cfg.package}/bin/upsdrvctl shutdown";
ExecStart = "${cfg.package}/bin/upsdrvctl -u root shutdown";
};
};