Skip to content

Commit

Permalink
Merge pull request #71207 from worldofpeace/nm-iwd-19.09
Browse files Browse the repository at this point in the history
[19.09] nixos/networkmanager: allow iwd as Wi-Fi backend
  • Loading branch information
worldofpeace committed Oct 16, 2019
2 parents 578fb2c + dcc4078 commit c35f716
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions nixos/modules/services/networking/networkmanager.nix
Expand Up @@ -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";

Expand Down Expand Up @@ -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}
'';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit c35f716

Please sign in to comment.