forked from mirrors/nixpkgs
nixos/networkmanager: allow iwd as Wi-Fi backend
This introduces an option wifi.backend to the networkmanager module. Co-authored-by: Cole Mickens <cole.mickens@gmail.com> Co-authored-by: worldofpeace <worldofpeace@protonmail.ch>
This commit is contained in:
parent
5edb20533d
commit
86dea5559f
|
@ -15,13 +15,15 @@ let
|
|||
networkmanager-openconnect
|
||||
networkmanager-openvpn
|
||||
networkmanager-vpnc
|
||||
] ++ optional (!delegateWireless) wpa_supplicant;
|
||||
] ++ optional (!delegateWireless && !enableIwd) wpa_supplicant;
|
||||
|
||||
dynamicHostsEnabled =
|
||||
cfg.dynamicHosts.enable && cfg.dynamicHosts.hostsDirs != {};
|
||||
|
||||
delegateWireless = config.networking.wireless.enable == true && cfg.unmanaged != [];
|
||||
|
||||
enableIwd = cfg.wifi.backend == "iwd";
|
||||
|
||||
# /var/lib/misc is for dnsmasq.leases.
|
||||
stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
|
||||
|
||||
|
@ -50,6 +52,7 @@ let
|
|||
|
||||
[device]
|
||||
wifi.scan-rand-mac-address=${if cfg.wifi.scanRandMacAddress then "yes" else "no"}
|
||||
wifi.backend=${cfg.wifi.backend}
|
||||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
|
@ -236,6 +239,15 @@ in {
|
|||
wifi = {
|
||||
macAddress = macAddressOpt;
|
||||
|
||||
backend = mkOption {
|
||||
type = types.enum [ "wpa_supplicant" "iwd" ];
|
||||
default = "wpa_supplicant";
|
||||
description = ''
|
||||
Specify the Wi-Fi backend used for the device.
|
||||
Currently supported are <option>wpa_supplicant</option> or <option>iwd</option> (experimental).
|
||||
'';
|
||||
};
|
||||
|
||||
powersave = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
|
@ -390,7 +402,7 @@ in {
|
|||
{ assertion = !dynamicHostsEnabled || (dynamicHostsEnabled && cfg.dns == "dnsmasq");
|
||||
message = ''
|
||||
To use networking.networkmanager.dynamicHosts you also need to set
|
||||
networking.networkmanager.dns = "dnsmasq"
|
||||
`networking.networkmanager.dns = "dnsmasq"`
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
@ -510,6 +522,8 @@ in {
|
|||
wireless.enable = mkDefault false;
|
||||
}) // (mkIf cfg.enableStrongSwan {
|
||||
networkmanager.packages = [ pkgs.networkmanager_strongswan ];
|
||||
}) // (mkIf enableIwd {
|
||||
wireless.iwd.enable = true;
|
||||
});
|
||||
|
||||
security.polkit.extraConfig = polkitConf;
|
||||
|
|
Loading…
Reference in a new issue