From 4966cec1e19edb77c2cffc2ab532f4e786c6f6f3 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 19 Aug 2023 23:20:07 +0530 Subject: [PATCH] switch to systemd-{resolved,networkd} --- hosts/rico1/default.nix | 2 +- hosts/rico1/network.nix | 33 +++++++++++++++++++++++++++++++++ hosts/rico2/default.nix | 2 +- hosts/rico2/network.nix | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 hosts/rico1/network.nix create mode 100644 hosts/rico2/network.nix diff --git a/hosts/rico1/default.nix b/hosts/rico1/default.nix index 68ef7c1..645df76 100644 --- a/hosts/rico1/default.nix +++ b/hosts/rico1/default.nix @@ -4,12 +4,12 @@ ./programs ./services ./containers + ./network.nix ./security.nix ]; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "Rico1"; i18n = { defaultLocale = "en_US.UTF-8"; diff --git a/hosts/rico1/network.nix b/hosts/rico1/network.nix new file mode 100644 index 0000000..6e07c8a --- /dev/null +++ b/hosts/rico1/network.nix @@ -0,0 +1,33 @@ +{lib, ...}: { + networking = { + hostName = "Rico1"; + useDHCP = lib.mkDefault false; + }; + + services.resolved.enable = true; + + systemd.network = { + enable = true; + networks = { + "40-ether" = { + enable = true; + matchConfig = { + Type = "ether"; + }; + networkConfig = { + DHCP = "yes"; + IgnoreCarrierLoss = "3s"; + }; + dhcpV4Config = { + UseDomains = true; + }; + ipv6AcceptRAConfig = { + UseDomains = true; + }; + linkConfig = { + RequiredForOnline = "yes"; + }; + }; + }; + }; +} diff --git a/hosts/rico2/default.nix b/hosts/rico2/default.nix index a815bd4..645df76 100644 --- a/hosts/rico2/default.nix +++ b/hosts/rico2/default.nix @@ -4,12 +4,12 @@ ./programs ./services ./containers + ./network.nix ./security.nix ]; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - networking.hostName = "Rico2"; i18n = { defaultLocale = "en_US.UTF-8"; diff --git a/hosts/rico2/network.nix b/hosts/rico2/network.nix new file mode 100644 index 0000000..6767bbe --- /dev/null +++ b/hosts/rico2/network.nix @@ -0,0 +1,33 @@ +{lib, ...}: { + networking = { + hostName = "Rico2"; + useDHCP = lib.mkDefault false; + }; + + services.resolved.enable = true; + + systemd.network = { + enable = true; + networks = { + "40-ether" = { + enable = true; + matchConfig = { + Type = "ether"; + }; + networkConfig = { + DHCP = "yes"; + IgnoreCarrierLoss = "3s"; + }; + dhcpV4Config = { + UseDomains = true; + }; + ipv6AcceptRAConfig = { + UseDomains = true; + }; + linkConfig = { + RequiredForOnline = "yes"; + }; + }; + }; + }; +}