nixos,networking: add myFlake.nixos.networking.network-configuration-daemon

This commit is contained in:
Guanran Wang 2023-11-09 13:08:07 +08:00
parent 6115991804
commit 112ae500c3
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
5 changed files with 32 additions and 22 deletions

View file

@ -1,6 +1,6 @@
{...}: {
imports = [
./dns.nix
./iwd.nix
./network-configuration-daemon.nix
];
}

View file

@ -1,3 +0,0 @@
{lib, ...}: {
networking.wireless.iwd.enable = lib.mkDefault true;
}

View file

@ -0,0 +1,31 @@
{
lib,
config,
...
}: let
cfg = config.myFlake.nixos.networking.network-configuration-daemon;
in {
options = {
myFlake.nixos = {
networking = {
network-configuration-daemon = lib.mkOption {
type = lib.types.enum ["iwd" "networkmanager" "networkmanager-iwd"];
default = "iwd";
example = "networkmanager";
description = "Select network configuration daemon";
};
};
};
};
config = {
networking.wireless.iwd.enable = lib.mkIf (cfg == "iwd" || cfg == "networkmanager-iwd") true;
networking.networkmanager = lib.mkIf (cfg == "networkmanager" || cfg == "networkmanager-iwd") {
enable = true;
ethernet.macAddress = "random";
wifi.macAddress = "random";
wifi.backend = lib.mkIf (cfg == "networkmanager-iwd") "iwd";
};
};
}

View file

@ -1,8 +0,0 @@
{...}: {
networking.networkmanager = {
enable = true;
wifi.backend = "iwd";
ethernet.macAddress = "random";
wifi.macAddress = "random";
};
}

View file

@ -1,10 +0,0 @@
{...}: {
networking = {
networkmanager = {
enable = true;
ethernet.macAddress = "random";
wifi.macAddress = "random";
};
wireless.iwd.enable = false;
};
}