Skip to content

Instantly share code, notes, and snippets.

@eliasp
Created December 3, 2018 22:56
Show Gist options
  • Save eliasp/31791ee266c26121dff0686b58e023b0 to your computer and use it in GitHub Desktop.
Save eliasp/31791ee266c26121dff0686b58e023b0 to your computer and use it in GitHub Desktop.
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index 2d76e0676b2..065cd108ad6 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -34,6 +34,8 @@ let
[device]
wifi.scan-rand-mac-address=${if cfg.wifi.scanRandMacAddress then "yes" else "no"}
+ ${optionalString (cfg.wifi.backend != null)
+ ''wifi.backend=${cfg.wifi.backend}''}
${cfg.extraConfig}
'';
@@ -139,7 +141,7 @@ in {
# Ugly hack for using the correct gnome3 packageSet
basePackages = mkOption {
type = types.attrsOf types.package;
- default = { inherit networkmanager modemmanager wpa_supplicant
+ default = { inherit networkmanager modemmanager
networkmanager-openvpn networkmanager-vpnc
networkmanager-openconnect networkmanager-fortisslvpn
networkmanager-l2tp networkmanager-iodine; };
@@ -194,6 +196,12 @@ in {
wifi = {
macAddress = macAddressOpt;
+ backend = mkOption {
+ type = types.enum ["wpa_supplicant" "iwd"];
+ default = "wpa_supplicant";
+ description = "WiFi Backend to be used by NetworkManager";
+ };
+
powersave = mkOption {
type = types.nullOr types.bool;
default = null;
@@ -510,7 +518,8 @@ in {
security.polkit.extraConfig = polkitConf;
networking.networkmanager.packages =
- mkIf cfg.enableStrongSwan [ pkgs.networkmanager_strongswan ];
+ mkIf cfg.enableStrongSwan [ pkgs.networkmanager_strongswan ]
+ ++ [ pkgs.${toString cfg.wifi.backend} ];
services.dbus.packages =
optional cfg.enableStrongSwan pkgs.strongswanNM ++ cfg.packages;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment