Merge pull request #71207 from worldofpeace/nm-iwd-19.09

[19.09] nixos/networkmanager: allow iwd as Wi-Fi backend
This commit is contained in:
worldofpeace
2019-10-16 23:27:46 +00:00
committed by GitHub

View File

@@ -15,12 +15,13 @@ let
networkmanager-openconnect
networkmanager-openvpn
networkmanager-vpnc
wpa_supplicant
];
] ++ optional (!enableIwd) wpa_supplicant;
dynamicHostsEnabled =
cfg.dynamicHosts.enable && cfg.dynamicHosts.hostsDirs != {};
enableIwd = cfg.wifi.backend == "iwd";
# /var/lib/misc is for dnsmasq.leases.
stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
@@ -48,6 +49,7 @@ let
[device]
wifi.scan-rand-mac-address=${if cfg.wifi.scanRandMacAddress then "yes" else "no"}
wifi.backend=${cfg.wifi.backend}
${cfg.extraConfig}
'';
@@ -234,6 +236,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;
@@ -509,13 +520,14 @@ in {
useDHCP = false;
# use mkDefault to trigger the assertion about the conflict above
wireless.enable = mkDefault false;
};
} // (mkIf cfg.enableStrongSwan {
networkmanager.packages = [ pkgs.networkmanager_strongswan ];
}) // (mkIf enableIwd {
wireless.iwd.enable = true;
});
security.polkit.extraConfig = polkitConf;
networking.networkmanager.packages =
mkIf cfg.enableStrongSwan [ pkgs.networkmanager_strongswan ];
services.dbus.packages =
optional cfg.enableStrongSwan pkgs.strongswanNM ++ cfg.packages;