move admin pass to a file instead of in config and create helpful attrs

This commit is contained in:
tdback 2024-11-12 20:07:14 -05:00
parent 29ee1f98e7
commit 75ffe93bd1

View file

@ -1,11 +1,13 @@
{ ... }: { lib, ... }:
let let
directories = [ ip = "10.0.0.203";
"/opt/pihole/" interface = "eno1";
]; directory = "/opt/pihole";
in 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 = { virtualisation.oci-containers.containers.pihole = {
image = "pihole/pihole:latest"; image = "pihole/pihole:latest";
autoStart = true; autoStart = true;
@ -15,14 +17,14 @@ in
"80:80/tcp" "80:80/tcp"
]; ];
volumes = [ volumes = [
"/opt/pihole/etc:/etc/pihole" "${directory}/etc:/etc/pihole"
"/opt/pihole/etc-dnsmasq.d:/etc/dnsmasq.d" "${directory}/etc-dnsmasq.d:/etc/dnsmasq.d"
]; ];
environment = { environment = {
TZ = "America/Detroit"; TZ = "America/Detroit";
WEBPASSWORD = "pihole4ALL!"; WEBPASSWORD_FILE = "${directory}/webpass";
FTLCONF_LOCAL_IPV4 = "10.0.0.202"; FTLCONF_LOCAL_IPV4 = ip;
INTERFACE = "eno1"; INTERFACE = interface;
}; };
extraOptions = [ "--network=host" ]; extraOptions = [ "--network=host" ];
}; };