This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / configs / gg23.nix
3.4 kB 134 lines
1{ pkgs, ... }: 2{ 3 # vodafone router drifts out of time 4 services.timesyncd.servers = [ 5 "0.pool.ntp.org" 6 "1.pool.ntp.org" 7 "2.pool.ntp.org" 8 "3.pool.ntp.org" 9 ]; 10 systemd.network.networks."50-et0" = { 11 matchConfig.Name = "et0"; 12 DHCP = "yes"; 13 linkConfig = { 14 RequiredForOnline = "routable"; 15 }; 16 networkConfig = { 17 IPv6AcceptRA = true; 18 IPv6Forwarding = true; 19 }; 20 }; 21 boot.kernel.sysctl."net.ipv4.ip_forward" = 1; 22 boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = 1; 23 systemd.network.networks."10-int0" = { 24 name = "int0"; 25 address = [ 26 "10.42.0.1/24" 27 "fd42:7d6a::1/64" 28 ]; 29 networkConfig = { 30 IPv4Forwarding = true; 31 IPv6Forwarding = true; 32 ConfigureWithoutCarrier = true; 33 DHCPServer = "yes"; 34 IPv6SendRA = true; 35 }; 36 # announce ourselves (dnsmasq) as resolver, so *.gg23 resolves for clients 37 dhcpServerConfig = { 38 EmitDNS = true; 39 DNS = "_server_address"; 40 EmitDomain = true; 41 Domain = "gg23"; 42 }; 43 ipv6SendRAConfig = { 44 EmitDNS = true; 45 DNS = [ "fd42:7d6a::1" ]; 46 EmitDomains = true; 47 Domains = [ "gg23" ]; 48 }; 49 ipv6Prefixes = [ 50 { 51 ipv6PrefixConfig = { 52 Prefix = "fd42:7d6a::/64"; 53 }; 54 } 55 ]; 56 dhcpServerStaticLeases = [ 57 { 58 # printer 59 dhcpServerStaticLeaseConfig = { 60 Address = "10.42.0.4"; 61 MACAddress = "94:dd:f8:23:c5:ac"; 62 }; 63 } 64 { 65 # firetv 66 dhcpServerStaticLeaseConfig = { 67 Address = "10.42.0.11"; 68 MACAddress = "84:28:59:f0:d2:a8"; 69 }; 70 } 71 { 72 # styx (et0), ex-router: snapserver, mosquitto, mycelium peer 73 dhcpServerStaticLeaseConfig = { 74 Address = "10.42.0.3"; 75 MACAddress = "3c:7c:3f:7e:e2:39"; 76 }; 77 } 78 # { 79 # dhcpServerStaticLeaseConfig = { 80 # Address = "10.42.0.10"; 81 # MACAddress = "ea:4d:12:94:74:2a"; 82 # }; 83 # } 84 { 85 dhcpServerStaticLeaseConfig = { 86 Address = "10.42.0.10"; 87 MACAddress = "fe:fe:fe:fe:fe:fe"; 88 }; 89 } 90 ]; 91 }; 92 networking.networkmanager.unmanaged = [ "int0" ]; 93 networking.firewall.trustedInterfaces = [ "int0" ]; 94 # ICMPv6 is forwarded by nixos-fw's forward chain already. 95 networking.firewall.extraForwardRules = '' 96 iifname "int0" accept 97 oifname "int0" accept 98 ''; 99 networking.nftables.tables.gg23 = { 100 family = "inet"; 101 content = '' 102 chain postrouting { 103 type nat hook postrouting priority srcnat; policy accept; 104 ip saddr 10.42.0.0/24 masquerade 105 ip6 saddr fd42:7d6a::/64 masquerade 106 } 107 ''; 108 }; 109 110 networking.domain = "gg23"; 111 112 networking.useHostResolvConf = false; 113 services.resolved.settings.Resolve.DNSStubListener = "no"; 114 services.dnsmasq = { 115 enable = true; 116 resolveLocalQueries = false; 117 118 settings = { 119 local = "/gg23/"; 120 domain = "gg23"; 121 expand-hosts = true; 122 listen-address = "10.42.0.1,10.233.0.1"; 123 interface = "int0"; 124 }; 125 }; 126 127 environment.systemPackages = [ 128 (pkgs.writers.writeDashBin "restart_router" '' 129 ${pkgs.mosquitto}/bin/mosquitto_pub -h localhost -t 'cmnd/router/POWER' -u gg23 -P gg23-mqtt -m OFF 130 sleep 2 131 ${pkgs.mosquitto}/bin/mosquitto_pub -h localhost -t 'cmnd/router/POWER' -u gg23 -P gg23-mqtt -m ON 132 '') 133 ]; 134}