From 01b01f06b40ad4a13ed0d0c676fe1f983ce470e7 Mon Sep 17 00:00:00 2001 From: Zuckerberg Date: Tue, 5 Aug 2025 19:27:23 -0700 Subject: [PATCH] Stop using systemd-networkd it has some flaws with NixOS' networking I need to figure out later. It is very elegant, easy to debug/understand, and I definitely want to use it but The most significant problem is it doesn't work with NixOS containers private networking. So I'll need to figure that out or maybe it will be fixed upstream soon. --- .../storage/s0/hardware-configuration.nix | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/machines/storage/s0/hardware-configuration.nix b/machines/storage/s0/hardware-configuration.nix index 7ed580a..40b19e8 100644 --- a/machines/storage/s0/hardware-configuration.nix +++ b/machines/storage/s0/hardware-configuration.nix @@ -58,25 +58,34 @@ }; swapDevices = [ ]; - systemd.network.enable = true; + ### networking ### + + # systemd.network.enable = true; networking = { - useNetworkd = true; - dhcpcd.enable = true; + # useNetworkd = true; + dhcpcd.enable = false; + vlans = { - main = { - id = 1; - interface = "eth1"; - }; iot = { id = 2; interface = "eth1"; }; }; - # Shouldn't be needed but it is. DHCP only works for a day or so while without these. - # This ensures that each interface is configured with DHCP - interfaces."main".useDHCP = true; - interfaces."iot".useDHCP = true; + interfaces.eth1.ipv4.addresses = [{ + address = "192.168.1.2"; + prefixLength = 21; + }]; + interfaces.iot.ipv4.addresses = [{ + address = "192.168.9.8"; + prefixLength = 22; + }]; + + defaultGateway = { + interface = "eth1"; + address = "192.168.1.1"; + }; + nameservers = [ "1.1.1.1" "8.8.8.8" ]; }; powerManagement.cpuFreqGovernor = "powersave";