From fbceccefe631e8524351d90ffe5c08cf7a6cc3a0 Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 28 Mar 2022 18:08:23 +0200 Subject: [PATCH] Migrate to systemd-networkd --- modules/networking.nix | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/modules/networking.nix b/modules/networking.nix index 1472e05..1c79913 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -9,26 +9,34 @@ enableIPv6 = false; }; + # Enable systemd-networkd + networking = { + useDHCP = false; + interfaces = { + enp0s31f6.useDHCP = true; + wlan0.useDHCP = true; + }; + useNetworkd = true; + dhcpcd.enable = false; + }; + systemd.services."systemd-networkd-wait-online".enable = false; + + # Static IP for home network + systemd.network.networks."24-home" = { + name = "wlan0"; + matchConfig = { + Name = "wlan0"; + SSID = "WiFi-5.0-CE42"; + }; + address = [ "192.168.1.131/24" ]; + gateway = [ "192.168.1.1" ]; + dns = [ "192.168.1.2" ]; + networkConfig.DNSSEC = "no"; + }; + # Enable zeroconf services.avahi = { enable = true; nssmdns = true; }; - - # Wireguard setup - networking.wg-quick.interfaces = { - home = { - address = [ "10.8.0.2/32" ]; - privateKeyFile = config.age.secrets.wireguard.path; - dns = [ "10.8.0.1" ]; - peers = [ - # zion - { - publicKey = "GN8lqPBZYOulh6xD4GhkoEWI65HMMCpSxJSH5871YnU="; - allowedIPs = [ "0.0.0.0/0" ]; - endpoint = "coolneng.duckdns.org:1194"; - } - ]; - }; - }; }