From e798c2f16b36bc5bb5cfb1684a443b2f7b2a5631 Mon Sep 17 00:00:00 2001 From: Hermes Date: Mon, 25 May 2026 00:15:58 -0400 Subject: [PATCH] feat: add APC Back-UPS BVK1200M2 NUT configuration Add power.ups module configuration for the APC Back-UPS BVK1200M2 connected via USB (vendor 051d, product 0002) in standalone mode. - Driver: usbhid-ups with auto port detection - upsd listening on localhost only - upsmon configured as master for graceful shutdown - Uses the built-in NixOS power.ups module --- hosts/lazyworkhorse/configuration.nix | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/hosts/lazyworkhorse/configuration.nix b/hosts/lazyworkhorse/configuration.nix index f1afae4..eb521a4 100644 --- a/hosts/lazyworkhorse/configuration.nix +++ b/hosts/lazyworkhorse/configuration.nix @@ -342,6 +342,44 @@ HIP_VISIBLE_DEVICES = "0,1"; }; + # ── UPS (Uninterruptible Power Supply) ────────────────────────────── + # APC Back-UPS BVK1200M2 connected via USB (vendor 051d, product 0002) + power.ups = { + enable = true; + mode = "standalone"; + + ups = { + apc-backups = { + driver = "usbhid-ups"; + port = "auto"; + description = "APC Back-UPS BVK1200M2"; + }; + }; + + upsd = { + listen = [{ + address = "127.0.0.1"; + }]; + }; + + users = { + nutmon = { + passwordFile = pkgs.writeText "ups-nutmon-password" "ups-nutmon-2025"; + upsmon = "primary"; + }; + }; + + upsmon = { + monitor = { + apc-backups = { + system = "apc-backups@localhost"; + user = "nutmon"; + type = "master"; + }; + }; + }; + }; + # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];