2024-11-12 21:53:39 -05:00
|
|
|
{ config, lib, ... }:
|
2024-11-10 17:54:08 -05:00
|
|
|
let
|
2024-11-12 20:07:14 -05:00
|
|
|
ip = "10.0.0.203";
|
|
|
|
interface = "eno1";
|
|
|
|
directory = "/opt/pihole";
|
2024-11-10 17:54:08 -05:00
|
|
|
in
|
|
|
|
{
|
2024-11-12 20:07:14 -05:00
|
|
|
systemd.tmpfiles.rules =
|
|
|
|
map (x: "d ${x} 0755 share share - -") (lib.lists.singleton directory);
|
|
|
|
|
2024-11-10 17:54:08 -05:00
|
|
|
virtualisation.oci-containers.containers.pihole = {
|
|
|
|
image = "pihole/pihole:latest";
|
|
|
|
autoStart = true;
|
|
|
|
ports = [
|
|
|
|
"53:53/udp"
|
|
|
|
"53:53/tcp"
|
|
|
|
"80:80/tcp"
|
|
|
|
];
|
|
|
|
volumes = [
|
2024-11-12 20:07:14 -05:00
|
|
|
"${directory}/etc:/etc/pihole"
|
|
|
|
"${directory}/etc-dnsmasq.d:/etc/dnsmasq.d"
|
2024-11-10 17:54:08 -05:00
|
|
|
];
|
|
|
|
environment = {
|
|
|
|
TZ = "America/Detroit";
|
2024-11-12 20:07:14 -05:00
|
|
|
FTLCONF_LOCAL_IPV4 = ip;
|
|
|
|
INTERFACE = interface;
|
2024-11-10 17:54:08 -05:00
|
|
|
};
|
|
|
|
extraOptions = [ "--network=host" ];
|
|
|
|
};
|
|
|
|
|
2024-11-12 21:53:39 -05:00
|
|
|
age.secrets.piholeAdminPass = {
|
|
|
|
file = ../../secrets/piholeAdminPass.age;
|
|
|
|
mode = "770";
|
|
|
|
owner = "share";
|
|
|
|
group = "share";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.podman-pihole.postStart =
|
|
|
|
let
|
|
|
|
password = config.age.secrets.piholeAdminPass.path;
|
|
|
|
in ''
|
|
|
|
podman exec -it pihole pihole -a -p ${password}
|
|
|
|
'';
|
|
|
|
|
2024-11-10 17:54:08 -05:00
|
|
|
networking.firewall = {
|
|
|
|
allowedTCPPorts = [ 53 80 ];
|
|
|
|
allowedUDPPorts = [ 53 ];
|
|
|
|
};
|
|
|
|
}
|