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-openconnect
|
||||||
networkmanager-openvpn
|
networkmanager-openvpn
|
||||||
networkmanager-vpnc
|
networkmanager-vpnc
|
||||||
] ++ optional (!delegateWireless) wpa_supplicant;
|
] ++ optional (!delegateWireless && !enableIwd) wpa_supplicant;
|
||||||
|
|
||||||
dynamicHostsEnabled =
|
dynamicHostsEnabled =
|
||||||
cfg.dynamicHosts.enable && cfg.dynamicHosts.hostsDirs != {};
|
cfg.dynamicHosts.enable && cfg.dynamicHosts.hostsDirs != {};
|
||||||
|
|
||||||
delegateWireless = config.networking.wireless.enable == true && cfg.unmanaged != [];
|
delegateWireless = config.networking.wireless.enable == true && cfg.unmanaged != [];
|
||||||
|
|
||||||
|
enableIwd = cfg.wifi.backend == "iwd";
|
||||||
|
|
||||||
# /var/lib/misc is for dnsmasq.leases.
|
# /var/lib/misc is for dnsmasq.leases.
|
||||||
stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
|
stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
|
||||||
|
|
||||||
|
@ -50,6 +52,7 @@ let
|
||||||
|
|
||||||
[device]
|
[device]
|
||||||
wifi.scan-rand-mac-address=${if cfg.wifi.scanRandMacAddress then "yes" else "no"}
|
wifi.scan-rand-mac-address=${if cfg.wifi.scanRandMacAddress then "yes" else "no"}
|
||||||
|
wifi.backend=${cfg.wifi.backend}
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
@ -236,6 +239,15 @@ in {
|
||||||
wifi = {
|
wifi = {
|
||||||
macAddress = macAddressOpt;
|
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 {
|
powersave = mkOption {
|
||||||
type = types.nullOr types.bool;
|
type = types.nullOr types.bool;
|
||||||
default = null;
|
default = null;
|
||||||
|
@ -390,7 +402,7 @@ in {
|
||||||
{ assertion = !dynamicHostsEnabled || (dynamicHostsEnabled && cfg.dns == "dnsmasq");
|
{ assertion = !dynamicHostsEnabled || (dynamicHostsEnabled && cfg.dns == "dnsmasq");
|
||||||
message = ''
|
message = ''
|
||||||
To use networking.networkmanager.dynamicHosts you also need to set
|
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;
|
wireless.enable = mkDefault false;
|
||||||
}) // (mkIf cfg.enableStrongSwan {
|
}) // (mkIf cfg.enableStrongSwan {
|
||||||
networkmanager.packages = [ pkgs.networkmanager_strongswan ];
|
networkmanager.packages = [ pkgs.networkmanager_strongswan ];
|
||||||
|
}) // (mkIf enableIwd {
|
||||||
|
wireless.iwd.enable = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
security.polkit.extraConfig = polkitConf;
|
security.polkit.extraConfig = polkitConf;
|
||||||
|
|
Loading…
Reference in a new issue