diff --git a/nixos/networking/default.nix b/nixos/networking/default.nix index eed7c14..2bd89dc 100755 --- a/nixos/networking/default.nix +++ b/nixos/networking/default.nix @@ -1,6 +1,6 @@ {...}: { imports = [ ./dns.nix - ./iwd.nix + ./network-configuration-daemon.nix ]; } diff --git a/nixos/networking/iwd.nix b/nixos/networking/iwd.nix deleted file mode 100644 index 2fedd82..0000000 --- a/nixos/networking/iwd.nix +++ /dev/null @@ -1,3 +0,0 @@ -{lib, ...}: { - networking.wireless.iwd.enable = lib.mkDefault true; -} diff --git a/nixos/networking/network-configuration-daemon.nix b/nixos/networking/network-configuration-daemon.nix new file mode 100644 index 0000000..37466a5 --- /dev/null +++ b/nixos/networking/network-configuration-daemon.nix @@ -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"; + }; + }; +} diff --git a/nixos/presets/core/networking/networkmanager-iwd.nix b/nixos/presets/core/networking/networkmanager-iwd.nix deleted file mode 100644 index 8db8d69..0000000 --- a/nixos/presets/core/networking/networkmanager-iwd.nix +++ /dev/null @@ -1,8 +0,0 @@ -{...}: { - networking.networkmanager = { - enable = true; - wifi.backend = "iwd"; - ethernet.macAddress = "random"; - wifi.macAddress = "random"; - }; -} diff --git a/nixos/presets/core/networking/networkmanager.nix b/nixos/presets/core/networking/networkmanager.nix deleted file mode 100644 index e0cfbd5..0000000 --- a/nixos/presets/core/networking/networkmanager.nix +++ /dev/null @@ -1,10 +0,0 @@ -{...}: { - networking = { - networkmanager = { - enable = true; - ethernet.macAddress = "random"; - wifi.macAddress = "random"; - }; - wireless.iwd.enable = false; - }; -}