From 1072924034eaacff781a4667e13bc935116e0e9d Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 7 Dec 2024 19:17:49 +0530 Subject: [PATCH] replace networkmanager with systemd-networkd (again) --- home/gtk.nix | 2 +- hosts/skipper/network/default.nix | 85 ++++++++++++++++++++--- hosts/skipper/persistence/persistence.nix | 8 +-- 3 files changed, 77 insertions(+), 18 deletions(-) diff --git a/home/gtk.nix b/home/gtk.nix index 355bbd5..51dac40 100644 --- a/home/gtk.nix +++ b/home/gtk.nix @@ -1,4 +1,4 @@ -{ pkgs, ...}: +{ pkgs, ... }: let theme = { name = "Dracula"; diff --git a/hosts/skipper/network/default.nix b/hosts/skipper/network/default.nix index cc57bec..a526494 100644 --- a/hosts/skipper/network/default.nix +++ b/hosts/skipper/network/default.nix @@ -7,6 +7,81 @@ fallbackDns = [ ]; }; + systemd = { + network = { + enable = true; + wait-online = { + enable = true; + anyInterface = true; + }; + networks = { + "20-virbr" = { + matchConfig = { + Name = "virbr*"; + Type = "bridge"; + }; + linkConfig = { + Unmanaged = true; + }; + }; + "21-docker" = { + matchConfig = { + Name = "docker*"; + Type = "bridge"; + }; + linkConfig = { + Unmanaged = true; + }; + }; + "22-veth" = { + matchConfig = { + Name = "veth*"; + Type = "ether"; + }; + linkConfig = { + Unmanaged = true; + }; + }; + "40-ether" = { + enable = true; + matchConfig = { + Type = "ether"; + }; + networkConfig = { + DHCP = "yes"; + }; + dhcpV4Config = { + UseDomains = true; + RouteMetric = 100; + }; + ipv6AcceptRAConfig = { + RouteMetric = 100; + }; + }; + "40-wireless" = { + enable = true; + matchConfig = { + Type = "wlan"; + }; + networkConfig = { + DHCP = "yes"; + IgnoreCarrierLoss = "3s"; + }; + dhcpV4Config = { + UseDomains = true; + RouteMetric = 600; + }; + ipv6AcceptRAConfig = { + RouteMetric = 600; + }; + linkConfig = { + RequiredForOnline = "routable"; + }; + }; + }; + }; + }; + networking = { nameservers = [ "10.10.10.1" @@ -34,16 +109,6 @@ ]; }; - networkmanager = { - enable = true; - dhcp = "dhcpcd"; - dns = "systemd-resolved"; - wifi = { - backend = "iwd"; - powersave = false; - }; - }; - wireless.iwd = { enable = true; settings = { diff --git a/hosts/skipper/persistence/persistence.nix b/hosts/skipper/persistence/persistence.nix index dbadb6a..cc398e0 100644 --- a/hosts/skipper/persistence/persistence.nix +++ b/hosts/skipper/persistence/persistence.nix @@ -1,8 +1,4 @@ -_: -let - persistant-path = "/persist/system"; -in -{ +_: let persistant-path = "/persist/system"; in { environment = { etc = { "machine-id" = { @@ -14,7 +10,6 @@ in persistence."${persistant-path}" = { hideMounts = true; directories = [ - "/etc/NetworkManager/system-connections" "/etc/systemd/nspawn" "/root/.local/share/nix" "/var/cache/fwupd" @@ -24,7 +19,6 @@ in "/var/lib/iwd" "/var/lib/libvirt" "/var/lib/machines" - "/var/lib/NetworkManager" "/var/lib/nixos" "/var/lib/portables" "/var/lib/systemd"