nix-configs/modules/networking/networkd.nix
2025-07-29 03:02:25 +02:00

63 lines
1.7 KiB
Nix

{
pkgs,
config,
lib,
...
}:
let
cfg = config.xyno.networking.networkd;
in
{
options.xyno.networking.networkd.enable = lib.mkEnableOption "enable systemd networkd";
options.xyno.networking.networkd.enableWifi = lib.mkEnableOption "enable iwd";
config = lib.mkIf cfg.enable {
systemd.network.enable = true;
networking.useNetworkd = true;
networking = {
dhcpcd.enable = false;
useDHCP = true;
useHostResolvConf = false;
};
# systemd.network.networks."60-wifi-client" = {
# matchConfig = {
# WLANInterfaceType = "station";
# };
# networkConfig = {
# DHCP = "yes";
# # IPv6AcceptRA = true;
# KeepConfiguration = "no";
# IPv6PrivacyExtensions = "kernel";
# };
# linkConfig.RequiredForOnline = "routable";
# dhcpV4Config = {
# RouteMetric = 1025;
# # IPv6OnlyMode = "yes";
# };
# ipv6AcceptRAConfig = {
# # UsePREF64 = true;
# RouteMetric = 1025;
# };
# };
# systemd.network.networks."60-ethernet-dhcp" = {
# matchConfig = {
# Kind = "!*";
# Type = "either";
# # Name = "en*";
# };
# linkConfig.RequiredForOnline = "routable";
# dhcpV4Config = {
# # IPv6OnlyMode = "yes";
# };
# networkConfig = {
# DHCP = "yes";
# # IPv6AcceptRA = true;
# KeepConfiguration = "no";
# IPv6PrivacyExtensions = "kernel";
# };
# # ipv6AcceptRAConfig.UsePREF64 = true;
# };
networking.wireless.iwd.enable = cfg.enableWifi;
xyno.impermanence.extraDirectories = lib.mkOptionals cfg.enableWifi [ "/var/lib/iwd" ];
# services.clatd.enable = true;
};
}