From 75ffe93bd1d02c3f82041a2895cae347f0c2a9ae Mon Sep 17 00:00:00 2001 From: tdback Date: Tue, 12 Nov 2024 20:07:14 -0500 Subject: [PATCH] move admin pass to a file instead of in config and create helpful attrs --- containers/pihole/default.nix | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/containers/pihole/default.nix b/containers/pihole/default.nix index 6c8042d..e144d83 100644 --- a/containers/pihole/default.nix +++ b/containers/pihole/default.nix @@ -1,11 +1,13 @@ -{ ... }: +{ lib, ... }: let - directories = [ - "/opt/pihole/" - ]; + ip = "10.0.0.203"; + interface = "eno1"; + directory = "/opt/pihole"; in { - systemd.tmpfiles.rules = map (x: "d ${x} 0755 share share - -") directories; + systemd.tmpfiles.rules = + map (x: "d ${x} 0755 share share - -") (lib.lists.singleton directory); + virtualisation.oci-containers.containers.pihole = { image = "pihole/pihole:latest"; autoStart = true; @@ -15,14 +17,14 @@ in "80:80/tcp" ]; volumes = [ - "/opt/pihole/etc:/etc/pihole" - "/opt/pihole/etc-dnsmasq.d:/etc/dnsmasq.d" + "${directory}/etc:/etc/pihole" + "${directory}/etc-dnsmasq.d:/etc/dnsmasq.d" ]; environment = { TZ = "America/Detroit"; - WEBPASSWORD = "pihole4ALL!"; - FTLCONF_LOCAL_IPV4 = "10.0.0.202"; - INTERFACE = "eno1"; + WEBPASSWORD_FILE = "${directory}/webpass"; + FTLCONF_LOCAL_IPV4 = ip; + INTERFACE = interface; }; extraOptions = [ "--network=host" ]; };