1
0
Fork 0
mirror of https://git.sr.ht/~roxwize/.dotfiles synced 2025-05-07 22:23:07 +00:00
This commit is contained in:
Rae 5e 2025-03-08 22:11:17 -05:00
parent f85fb25d59
commit 8037e88c20
Signed by: rae
GPG key ID: 5B1A0FAB9BAB81EE
4 changed files with 48 additions and 31 deletions

View file

@ -2,7 +2,7 @@
cfg = config.r5e.containers.pihole;
in with lib; {
options.r5e.containers.pihole = {
enable = mkEnableOption "pihole";
enable = mkEnableOption "Pi-hole";
openFirewall = mkOption {
type = types.bool;
default = false;
@ -19,6 +19,10 @@ in with lib; {
type = types.str;
default = "";
};
dhcp = {
enable = mkEnableOption "the Pi-hole DHCP server";
};
};
config = mkIf cfg.enable (mkMerge [
@ -32,12 +36,12 @@ in with lib; {
ports = [
(builtins.toString cfg.listenPortHTTP + ":80/tcp")
(builtins.toString cfg.listenPortHTTPS + ":443/tcp")
];
] ++ (optional cfg.dhcp.enable "67:67/udp");
};
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ 53 cfg.listenPortHTTP cfg.listenPortHTTPS ];
allowedUDPPorts = [ 53 67 ];
allowedUDPPorts = [ 53 ] ++ (optional cfg.dhcp.enable 67);
};
}
]);