style: requested change

This commit is contained in:
catvayor 2024-04-21 15:36:46 +02:00 committed by thubrecht
parent 4d16839a10
commit 1eea46b59f

View file

@ -1,18 +1,23 @@
{ pkgs, config, ... }: {
pkgs,
lib,
config,
...
}:
{ {
power.ups = { power.ups = {
enable = true; enable = true;
ups."eaton" = { ups.eaton = {
driver = "usbhid-ups"; driver = "usbhid-ups";
port = "auto"; port = "auto";
}; };
upsmon.enable = false; upsmon.enable = false;
users."eatonMon" = { users.eatonmon = {
passwordFile = config.age.secrets."eatonmon-password_file".path; passwordFile = config.age.secrets."eatonmon-password_file".path;
upsmon = "primary"; upsmon = "primary";
}; };
upsmon.monitor."eaton" = { upsmon.monitor.eaton = {
user = "eatonMon"; user = "eatonmon";
}; };
schedulerRules = schedulerRules =
let let
@ -32,7 +37,7 @@
*) MEANING="Signal unknown, check configuration.";; *) MEANING="Signal unknown, check configuration.";;
esac esac
sendmail -i -t <<ERRMAIL sendmail -i -t <<ERRMAIL
To: fai@dgnum.eu To: fai+monitoring@dgnum.eu
Subject: [$HOSTNAME] Battery signal: $1 Subject: [$HOSTNAME] Battery signal: $1
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
@ -45,8 +50,11 @@
esac esac
''; '';
}; };
rules = '' in
CMDSCRIPT ${cmdScript}/bin/upssched-cmd.sh (pkgs.writeTextFile {
name = "upssched.conf";
text = ''
CMDSCRIPT ${lib.getExe cmdScript}
PIPEFN /var/state/ups/upssched/upssched.pipe PIPEFN /var/state/ups/upssched/upssched.pipe
LOCKFN /var/state/ups/upssched/upssched.lock LOCKFN /var/state/ups/upssched/upssched.lock
AT LOWBATT * EXECUTE shutdown-low AT LOWBATT * EXECUTE shutdown-low
@ -57,10 +65,6 @@
AT NOCOMM * EXECUTE warn-comm AT NOCOMM * EXECUTE warn-comm
AT BYPASS * EXECUTE warn-bypass AT BYPASS * EXECUTE warn-bypass
''; '';
in
(pkgs.writeTextFile {
name = "upssched.conf";
text = rules;
}).outPath; }).outPath;
}; };