2023-11-09 05:08:07 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
2023-12-15 18:40:18 +00:00
|
|
|
cfg = config.myFlake.networking;
|
2023-11-09 05:08:07 +00:00
|
|
|
in {
|
|
|
|
options = {
|
2023-12-15 18:40:18 +00:00
|
|
|
myFlake = {
|
2023-11-09 05:08:07 +00:00
|
|
|
networking = {
|
|
|
|
network-configuration-daemon = lib.mkOption {
|
|
|
|
type = lib.types.enum ["iwd" "networkmanager" "networkmanager-iwd"];
|
|
|
|
default = "iwd";
|
|
|
|
example = "networkmanager";
|
2023-11-17 07:17:12 +00:00
|
|
|
description = "Select desired network configuration daemon.";
|
2023-11-09 05:08:07 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-11-17 07:17:12 +00:00
|
|
|
config = lib.mkMerge [
|
|
|
|
(lib.mkIf (cfg.network-configuration-daemon == "iwd") {
|
|
|
|
networking.wireless.iwd.enable = true;
|
|
|
|
})
|
|
|
|
(lib.mkIf (cfg.network-configuration-daemon == "networkmanager" || cfg.network-configuration-daemon == "networkmanager-iwd") {
|
|
|
|
networking.networkmanager = {
|
|
|
|
enable = true;
|
|
|
|
ethernet.macAddress = "random";
|
|
|
|
wifi.macAddress = "random";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(lib.mkIf (cfg.network-configuration-daemon == "networkmanager-iwd") {
|
|
|
|
networking.wireless.iwd.enable = true;
|
|
|
|
networking.networkmanager.wifi.backend = "iwd";
|
|
|
|
})
|
|
|
|
];
|
2023-11-09 05:08:07 +00:00
|
|
|
}
|