home: i3bar: setup restic backup status "LED"

This commit is contained in:
Antoine Martin 2024-02-22 18:36:59 +01:00
parent d9f54c15a7
commit 692fa8cd20

View file

@ -91,6 +91,22 @@ in {
chip = cfg.temperature.chip; chip = cfg.temperature.chip;
inputs = cfg.temperature.inputs; inputs = cfg.temperature.inputs;
} }
{
block = "custom";
# TODO: get service name programmatically somehow
command = let
systemctl = lib.getExe' pkgs.systemd "systemctl";
in
pkgs.writeShellScript "check-restic.sh" ''
BACKUP_STATUS=Good
if ${systemctl} is-failed --quiet restic-backups-backblaze.service; then
BACKUP_STATUS=Critical
fi
echo "{\"state\": \"$BACKUP_STATUS\", \"text\": \"Backup\"}"
'';
json = true;
interval = 60;
}
] ]
++ ( ++ (
lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0) lists.optionals ((builtins.length cfg.networking.throughput_interfaces) != 0)