1
0
Fork 0
mirror of https://git.sr.ht/~roxwize/.dotfiles synced 2025-05-14 01:23:05 +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);
};
}
]);

View file

@ -21,7 +21,6 @@
ports = [
"53:53/tcp"
"53:53/udp"
"67:67/udp"
"80:80/tcp"
"443:443/tcp"
];

View file

@ -13,7 +13,7 @@ services:
# Default HTTPs Port. FTL will generate a self-signed certificate
- "443:443/tcp"
# Uncomment the line below if you are using Pi-hole as your DHCP server
- "67:67/udp"
#- "67:67/udp"
# Uncomment the line below if you are using Pi-hole as your NTP server
#- "123:123/udp"
environment: