From a552dcd540a8d1fa0de51bf312c7c5da8c1ae0a8 Mon Sep 17 00:00:00 2001 From: Jacob Hinkle Date: Tue, 30 Aug 2022 15:30:59 -0400 Subject: [PATCH] Fix pihole resolving hosts address using /etc/hosts --- machines/pedro/configuration.nix | 26 +------------------------- machines/pedro/pihole.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 25 deletions(-) create mode 100644 machines/pedro/pihole.nix diff --git a/machines/pedro/configuration.nix b/machines/pedro/configuration.nix index dbce9a3..7f7c546 100644 --- a/machines/pedro/configuration.nix +++ b/machines/pedro/configuration.nix @@ -122,31 +122,7 @@ virtualisation.oci-containers.containers = let serverIP = "192.168.88.21"; in { - pihole = { - image = "pihole/pihole:2022.07.1"; - ports = [ - "${serverIP}:53:53/tcp" - "${serverIP}:53:53/udp" - "8088:80" - "4438:443" - ]; - environment = { - TZ = "America/New_York"; - ServerIP = serverIP; - WEBPASSWORD_FILE = "/run/secrets/pihole/webpassword"; - }; - #extraDockerOptions = [ - ##"--cap-add=NET_ADMIN" - #"--dns=127.0.0.1" - #"--dns=1.1.1.1" - #]; - volumes = [ - "/serverdata/pihole/etc/pihole:/etc/pihole" - "/serverdata/pihole/etc/dnsmasq.d:/etc/dnsmasq.d" - "/run/secrets/pihole:/run/secrets/pihole" - ]; - #workdir = "/serverdata/pihole/etc/pihole"; - }; + pihole = import ./pihole.nix serverIP; }; # List services that you want to enable: diff --git a/machines/pedro/pihole.nix b/machines/pedro/pihole.nix new file mode 100644 index 0000000..b16f24b --- /dev/null +++ b/machines/pedro/pihole.nix @@ -0,0 +1,26 @@ +serverIP : +{ + image = "pihole/pihole:2022.07.1"; + ports = [ + "${serverIP}:53:53/tcp" + "${serverIP}:53:53/udp" + "8088:80" + "4438:443" + ]; + environment = { + TZ = "America/New_York"; + ServerIP = serverIP; + FTLCONF_LOCAL_IPV4 = serverIP; + WEBPASSWORD_FILE = "/run/secrets/pihole/webpassword"; + TEMPERATUREUNIT = "f"; + REPLY_ADDR4 = serverIP; + }; + volumes = [ + "/serverdata/pihole/etc/pihole:/etc/pihole" + "/serverdata/pihole/etc/dnsmasq.d:/etc/dnsmasq.d" + "/run/secrets/pihole:/run/secrets/pihole" + ]; + extraOptions = [ + "--no-hosts" # do not populate internal /etc/hosts with container host's + ]; +}