From 671e66917b09c56ca9e717b300b874ed71b189ae Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Sun, 19 Oct 2025 17:45:49 +0200 Subject: nixfmt --- router.nix | 57 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'router.nix') diff --git a/router.nix b/router.nix index 338bc83..1b2eb51 100644 --- a/router.nix +++ b/router.nix @@ -16,25 +16,35 @@ in internalInterfaces = [ "br0" ]; # forwardPorts = [{ sourcePort = 1234; destination = "10.69.0.2:12345"; }]; }; - bridges.br0.interfaces = [ lanInterface wifiInterface ]; - interfaces.br0.ipv4.addresses = [{ - address = "10.69.0.1"; - prefixLength = 16; - }]; + bridges.br0.interfaces = [ + lanInterface + wifiInterface + ]; + interfaces.br0.ipv4.addresses = [ + { + address = "10.69.0.1"; + prefixLength = 16; + } + ]; networkmanager = { enable = true; - unmanaged = [ "interface-name:${lanInterface}" "interface-name:${wifiInterface}" ]; - dispatcherScripts = [ { - type = "basic"; - source = pkgs.writeScript "dynamic-dns-on-ipv4-change" '' - #!/bin/sh + unmanaged = [ + "interface-name:${lanInterface}" + "interface-name:${wifiInterface}" + ]; + dispatcherScripts = [ + { + type = "basic"; + source = pkgs.writeScript "dynamic-dns-on-ipv4-change" '' + #!/bin/sh - [ "$1" = "${wanInterface}" ] || exit - [ "$2" = dhcp4-change ] || exit - ${pkgs.curl}/bin/curl "$(cat "${config.age.secrets."dyndns-url.txt".path}")" - date >> /home/mathias/networkmanager-dispatcherScripts-run - ''; - } ]; + [ "$1" = "${wanInterface}" ] || exit + [ "$2" = dhcp4-change ] || exit + ${pkgs.curl}/bin/curl "$(cat "${config.age.secrets."dyndns-url.txt".path}")" + date >> /home/mathias/networkmanager-dispatcherScripts-run + ''; + } + ]; }; }; services.hostapd = { @@ -65,11 +75,17 @@ in domain = "m"; local = "/m/"; - server = [ "1.1.1.1" "1.0.0.1" ]; + server = [ + "1.1.1.1" + "1.0.0.1" + ]; interface = "br0"; dhcp-range = "10.69.0.50,10.69.0.254,255.255.0.0,1h"; - dhcp-option = [ "option:router,10.69.0.1" "option:dns-server,10.69.0.1" ]; + dhcp-option = [ + "option:router,10.69.0.1" + "option:dns-server,10.69.0.1" + ]; dhcp-authoritative = true; no-hosts = true; @@ -82,7 +98,10 @@ in }; }; networking.nameservers = [ "127.0.0.1" ]; - networking.firewall.allowedUDPPorts = [ 53 67 ]; + networking.firewall.allowedUDPPorts = [ + 53 + 67 + ]; networking.firewall.allowedTCPPorts = [ 53 ]; oden.persist.directories = [ "/var/lib/dnsmasq" ]; -- cgit v1.2.3