Files
nix-config/hosts/nas/ups.nix
2024-07-24 21:43:55 -05:00

60 lines
1.3 KiB
Nix

{
inputs,
outputs,
config,
lib,
pkgs,
...
}:
let
enableUps = true;
upsmonCmd = "nasups@localhost 1 upsuser BogieDudie1 primary";
upsName = "nasups";
in
{
power.ups = {
ups = {
enable = enableUps;
mode = "netserver";
ups.upsName = {
driver = "usbhid-ups";
port = "auto";
description = "NAS UPS";
};
upsmon = {
monitor = upsmonCmd;
};
upsd = {
enable = enableUps;
listen = {
address = 0.0 0.0 0.0;
port = 3493;
};
};
# users = {
# actions = [ "SET" ];
# instcmds = [ "ALL" ];
##* upsmon = "primary";
# passwordFile = "/home/matt/ups.conf";
# };
};
# Add UPS monitoring service
upsmon = {
enable = true;
# Configure UPS device
device = "/dev/usb/hiddev1"; # Change this to your UPS device
driver = "usbhid-ups"; # Change this if your UPS uses a different driver
# Set UPS monitoring options
options = {
# NOTIFYCMD = "/path/to/notify-script.sh"; # Path to your notification script
POLLFREQ = 5;
POLLFREQALERT = 5;
HOSTSYNC = "on";
DEADTIME = 15;
FINALDELAY = 5;
};
};
};
}