Add nixos/modules/watchdog.nix

This commit is contained in:
gigirassy
2025-11-10 17:06:24 +01:00
parent 44a4342cd0
commit 120d60ac6f
+24
View File
@@ -0,0 +1,24 @@
{ config, pkgs, ... }:
{
systemd.services.anubis-watchdog = {
description = "Anubis Docker logs -> AbuseIPDB watchdog";
after = [ "network.target" "docker.service" ];
wantedBy = [ "multi-user.target" ];
# make docker/curl available to the unit's PATH (Nix-native)
path = [ pkgs.docker pkgs.curl pkgs.python3 pkgs.nftables ];
serviceConfig = {
ExecStart = "${pkgs.python3}/bin/python3 /etc/anubis-watchdog/watchdog.py";
Restart = "on-failure";
RestartSec = "10";
User = "root";
Environment = [
"ABUSEIPDB_KEY_FILE=/etc/anubis-watchdog/abuseipdb.key"
"DOCKER_BIN=/run/current-system/sw/bin/docker"
# optional: "CURL_BIN=/run/current-system/sw/bin/curl"
];
};
};
}