From b646de4f08a74fac38d53bfa9252672324dc062a Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Tue, 10 Jun 2025 20:57:15 +0200 Subject: [PATCH] Lib/Networking: Add mkStaticNetworkManagerProfile function --- lib/networking.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/networking.nix b/lib/networking.nix index 04bda651..8499ee36 100644 --- a/lib/networking.nix +++ b/lib/networking.nix @@ -79,6 +79,29 @@ }; }; + # TODO: What other config options are there? + mkStaticNetworkManagerProfile = { + id, + interface, + ip, + router, + nameserver, + autoconnect, + }: { + connection = { + inherit id autoconnect; + type = "ethernet"; + interface-name = interface; + }; + + ipv4 = { + method = "manual"; + addresses = ip; + gateway = router; + dns = nameserver; + }; + }; + mkNetworkNamespace = name: '' ${pkgs.iproute2}/bin/ip netns add ${name} # Create the Namespace ${pkgs.iproute2}/bin/ip -n ${name} link set lo up # Enable the Loopback device