From d69819ebb7b7cab9d69db39fd3675aa687d4bad3 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Mon, 17 Jun 2024 21:48:57 +0700 Subject: [PATCH] pihole: now restarts when caddy virtual hosts changes --- system/podman/pihole.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/podman/pihole.nix b/system/podman/pihole.nix index 4c03dec..81b85b0 100644 --- a/system/podman/pihole.nix +++ b/system/podman/pihole.nix @@ -3,7 +3,7 @@ let name = "pihole"; podman = config.profile.podman; pihole = podman.pihole; - inherit (lib) mkIf; + inherit (lib) mkIf lists; gateway = "10.1.1.1"; subnet = "10.1.1.0/30"; ip = "10.1.1.2"; @@ -35,6 +35,9 @@ in script = ''${pkgs.podman}/bin/podman network exists ${name} || ${pkgs.podman}/bin/podman network create --gateway=${gateway} --subnet=${subnet} --ip-range=${ip-range} ${name}''; }; + # We have refresh the custom.list dns list when caddy virtual hosts changes, + # the easiest way to do so is to restart the pihole container + systemd.services."podman-${name}".partOf = lists.optional (config.services.caddy.enable) "caddy.service"; environment.etc."pihole/custom.list" = { # Copy file instead of symlink mode = "0444";