From 120d60ac6f945aa8d4955bc856449ab8634f0a0e Mon Sep 17 00:00:00 2001 From: gigirassy Date: Mon, 10 Nov 2025 17:06:24 +0100 Subject: [PATCH] Add nixos/modules/watchdog.nix --- nixos/modules/watchdog.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 nixos/modules/watchdog.nix diff --git a/nixos/modules/watchdog.nix b/nixos/modules/watchdog.nix new file mode 100644 index 0000000..6170db0 --- /dev/null +++ b/nixos/modules/watchdog.nix @@ -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" + ]; + }; + }; +} \ No newline at end of file