aboutsummaryrefslogtreecommitdiff
path: root/modules/networking/nixos/networkd.nix
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-07-29 06:54:49 -0500
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-07-29 06:54:49 -0500
commite29dd8a2283399b7e046937340509d5aec4b52ba (patch)
treeaa679e70fe55cb620698ab1695eadf23f8a2cdba /modules/networking/nixos/networkd.nix
parentd2aecd69c17fa64305c07333686576152432993d (diff)
changes
Diffstat (limited to 'modules/networking/nixos/networkd.nix')
-rw-r--r--modules/networking/nixos/networkd.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/networking/nixos/networkd.nix b/modules/networking/nixos/networkd.nix
new file mode 100644
index 0000000..2c7f580
--- /dev/null
+++ b/modules/networking/nixos/networkd.nix
@@ -0,0 +1,44 @@
+{
+ # lib,
+ config,
+ ...
+}: let
+ cfg = config.collinux.system.network;
+ dhcp_enabled = cfg.static == null;
+
+ device =
+ if (cfg.wireless == null)
+ then "eth0"
+ else "wl*";
+in {
+ networking.useNetworkd = true;
+ systemd.network = {
+ enable = true;
+
+ wait-online = {
+ enable = true;
+ ignoredInterfaces = ["docker0"];
+ anyInterface = true;
+ };
+
+ networks."11-default" =
+ if dhcp_enabled
+ then {
+ name = device;
+ networkConfig.DHCP = "yes";
+
+ # never accept dhcp dns
+ dhcpV4Config.UseDNS = "no";
+ dhcpV6Config.UseDNS = "no";
+ }
+ else {
+ name = device;
+ networkConfig = {
+ Address = cfg.static.ip;
+ Gateway = cfg.static.gateway;
+ DHCP = "no";
+ # DNS is managed by systemd-resolved (not specified here)
+ };
+ };
+ };
+}