blob: 8a36007727c2005336697209f273c9fd07361b2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
{ config, lib, ... }:
let
cfg = config.os.srv.ups;
in
{
options.os.srv.ups.enable = lib.mkEnableOption "enables smooth shutdown on power loss";
config = lib.mkIf cfg.enable {
power.ups = {
enable = true;
mode = "standalone";
ups.main = {
driver = "usbhid-ups";
port = "auto";
description = "Main Server UPS";
};
users.upsmon = {
# TODO make password
passwordFile = "sops";
upsmon = "master";
};
upsmon.monitor.main = {
system = "main@localhost";
user = "upsmon";
# TODO password
passwordFile = "sops";
type = "master";
};
settings = {
MINSUPPLIES = 1;
POWERDOWNFLAG = "/run/killpower";
};
};
};
}
|