Files
Olympus/system/virtualization/docker/pihole/default.nix
2026-01-20 13:34:12 -06:00

71 lines
1.9 KiB
Nix

{ config, lib, ... }: {
options.sysconfig.docker.pihole.enable = with lib; mkOption {
type = with types; bool;
default = false;
};
config = lib.mkIf (config.sysconfig.docker.pihole.enable && config.sysconfig.docker.enable) {
environment.etc."resolv.conf" = {
enable = true;
text = ''
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 1.0.0.1
options edns0
'';
user = "root";
mode = "0664";
};
networking.firewall.interfaces = {
"ve-traefik" = {
allowedTCPPorts = [ 9001 ];
};
};
virtualisation.oci-containers.containers.pihole = {
image = "pihole/pihole:latest";
# unstable, waiting for 26.05
#pull = "newer";
hostname = "pihole.esotericbytes.com";
networks = [
"docker-main"
];
labels = {
"traefik.http.routers.pihole.entrypoints" = "localsecure";
"traefik.http.routers.pihole.rule" = "Host(`pihole.esotericbytes.com`)";
"traefik.http.routers.pihole.service" = "pihole";
"traefik.http.routers.pihole.tls.certResolver" = "cloudflare";
"traefik.http.services.pihole.loadbalancer.server.url" = "http://192.168.100.10:9001";
};
extraOptions = lib.mkIf config.sysconfig.docker.nvidia [
"--ip=192.168.101.3"
];
ports = [
"9001:80"
"127.0.0.1:53:53/tcp"
"127.0.0.1:53:53/udp"
];
volumes = [
"vol_pihole:/etc/pihole"
];
environment = {
FTLCONF_webserver_api_password = "7567";
FTLCONF_dns_listeningMode = "ALL";
};
};
};
}