feat: docker for pi hole

This commit is contained in:
s-prechtl 2025-03-31 14:15:59 +02:00
parent 93942581c6
commit 168b38b49d

View file

@ -6,7 +6,9 @@
lib,
pkgs,
...
}: {
}: let
serverIP = 0.0 .0 .0;
in {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
@ -35,5 +37,32 @@
};
};
virtualisation.docker.enable = true;
virtualisation.oci-containers = {
backend = "docker";
virtualisation.oci-containers.containers.pihole = {
image = "pihole/pihole:latest";
ports = [
"${serverIP}:53:53/tcp"
"${serverIP}:53:53/udp"
"3080:80"
"30443:443"
];
volumes = [
"/var/lib/pihole/:/etc/pihole/"
"/var/lib/dnsmasq.d:/etc/dnsmasq.d/"
];
environment = {
ServerIP = serverIP;
};
extraOptions = [
"--cap-add=NET_ADMIN"
"--dns=127.0.0.1"
"--dns=1.1.1.1"
];
workdir = "/var/lib/pihole/";
};
};
system.stateVersion = "24.11";
}