diff options
author | arcnmx <arcnmx@users.noreply.github.com> | 2019-12-21 13:48:15 -0800 |
---|---|---|
committer | arcnmx <arcnmx@users.noreply.github.com> | 2019-12-21 13:48:15 -0800 |
commit | 7753d58e891450081a9ec3afec6c87e462bda44e (patch) | |
tree | 66b721456a1f7f01be16a059427beae1c1b1dc55 /nixos/modules/services | |
parent | b1b55ba0f6af258a23467c82243aa6bcf26616ae (diff) | |
download | nixlib-7753d58e891450081a9ec3afec6c87e462bda44e.tar nixlib-7753d58e891450081a9ec3afec6c87e462bda44e.tar.gz nixlib-7753d58e891450081a9ec3afec6c87e462bda44e.tar.bz2 nixlib-7753d58e891450081a9ec3afec6c87e462bda44e.tar.lz nixlib-7753d58e891450081a9ec3afec6c87e462bda44e.tar.xz nixlib-7753d58e891450081a9ec3afec6c87e462bda44e.tar.zst nixlib-7753d58e891450081a9ec3afec6c87e462bda44e.zip |
nixos/connman: optional iwd backend
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/networking/connman.nix | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/nixos/modules/services/networking/connman.nix b/nixos/modules/services/networking/connman.nix index 8402be939fe5..e8eadc4e187d 100644 --- a/nixos/modules/services/networking/connman.nix +++ b/nixos/modules/services/networking/connman.nix @@ -11,6 +11,7 @@ let ${cfg.extraConfig} ''; + enableIwd = cfg.wifi.backend == "iwd"; in { imports = [ @@ -56,6 +57,17 @@ in { ''; }; + wifi = { + backend = mkOption { + type = types.enum [ "wpa_supplicant" "iwd" ]; + default = "wpa_supplicant"; + description = '' + Specify the Wi-Fi backend used. + Currently supported are <option>wpa_supplicant</option> or <option>iwd</option>. + ''; + }; + }; + extraFlags = mkOption { type = with types; listOf str; default = [ ]; @@ -77,9 +89,6 @@ in { assertion = !config.networking.useDHCP; message = "You can not use services.connman with networking.useDHCP"; }{ - assertion = config.networking.wireless.enable; - message = "You must use services.connman with networking.wireless"; - }{ assertion = !config.networking.networkmanager.enable; message = "You can not use services.connman with networking.networkmanager"; }]; @@ -89,12 +98,18 @@ in { systemd.services.connman = { description = "Connection service"; wantedBy = [ "multi-user.target" ]; - after = [ "syslog.target" ]; + after = [ "syslog.target" ] ++ optional enableIwd "iwd.service"; + requires = optional enableIwd "iwd.service"; serviceConfig = { Type = "dbus"; BusName = "net.connman"; Restart = "on-failure"; - ExecStart = "${pkgs.connman}/sbin/connmand --config=${configFile} --nodaemon ${toString cfg.extraFlags}"; + ExecStart = toString ([ + "${pkgs.connman}/sbin/connmand" + "--config=${configFile}" + "--nodaemon" + ] ++ optional enableIwd "--wifi=iwd_agent" + ++ cfg.extraFlags); StandardOutput = "null"; }; }; @@ -125,7 +140,12 @@ in { networking = { useDHCP = false; - wireless.enable = true; + wireless = { + enable = mkIf (!enableIwd) true; + iwd = mkIf enableIwd { + enable = true; + }; + }; networkmanager.enable = false; }; }; |