fix: several typo & errors on the dns config

This commit is contained in:
Xavier Morel
2025-10-24 19:48:09 +02:00
parent 16b9271caf
commit f9446df46d
5 changed files with 18 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ in
{ {
out = '' out = ''
logging { logging {
level = "warning" level = "warn"
} }
loki.write "grafana_loki" { loki.write "grafana_loki" {
endpoint { endpoint {

View File

@@ -15,8 +15,11 @@ in
# OPTIONAL string swap: swap space (default null) # OPTIONAL string swap: swap space (default null)
swap = null; swap = null;
# OPTIONAL list of int ports: ports to open (TCP tho) (default []) # OPTIONAL list of int tcp_ports: TCP ports to open (default [])
ports = [ 80 ]; tcp_ports = [ 80 ];
# OPTIONAL list of int udp_ports: UDP ports to open (default [])
udp_ports = [ ];
# OPTIONAL submodule services: services to be passed to the NixOS Module (default {}) # OPTIONAL submodule services: services to be passed to the NixOS Module (default {})
services = { services = {

View File

@@ -9,7 +9,8 @@ let
disk = def.disk or "4G"; disk = def.disk or "4G";
swap = def.swap or 512; swap = def.swap or 512;
services = def.services or { }; services = def.services or { };
open_ports = def.open_ports or [ ]; tcp_ports = def.tcp_ports or [ ];
udp_ports = def.udp_ports or [ ];
other_packages = def.other_packages or [ ]; other_packages = def.other_packages or [ ];
etc = def.etc or { }; etc = def.etc or { };
logging_enabled = def.logging.enable or false; # TODO: Implement logging_enabled = def.logging.enable or false; # TODO: Implement
@@ -54,7 +55,11 @@ in
] ]
++ extraModules; ++ extraModules;
networking.hostName = hostname; networking.hostName = hostname;
networking.firewall.allowedTCPPorts = open_ports; networking.firewall = {
enable = true;
allowedTCPPorts = tcp_ports;
allowedUDPPorts = udp_ports;
};
services = services =
services services
// lib.optionalAttrs (logging_enabled) { // lib.optionalAttrs (logging_enabled) {

View File

@@ -13,16 +13,18 @@ let
in in
{ {
cores = 2; cores = 2;
memory = "2G"; memory = 1024;
disk = "4G"; disk = "4G";
swap = 512; swap = 512;
ports = [ tcp_ports = [
80 80
53 53
12345 12345
]; ];
udp_ports = [ 53 ];
exposed = false; exposed = false;
services = { services = {
resolved.enable = false;
adguardhome = import ./dns/adguardhome-config.nix { inherit infra ip domainname; }; adguardhome = import ./dns/adguardhome-config.nix { inherit infra ip domainname; };
unbound = { unbound = {
enable = true; enable = true;

View File

@@ -23,7 +23,7 @@
} }
} }
loki.process "unbound_router" { loki.process "unbd_router" {
stage.pattern { stage.pattern {
pattern = "[<_>] <level>: <message>" pattern = "[<_>] <level>: <message>"
} }