diff options
author | Peter Hoeg <peter@hoeg.com> | 2021-10-16 21:15:48 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2022-03-22 19:36:51 +0800 |
commit | 052632fd15550d83fe98ed599c8504eaad67f0b5 (patch) | |
tree | 44677c7b964bad382af871f90d3fb587973a9761 /nixos/modules | |
parent | 2040fc90e088eb4b92d8b3e7f98f7cc31e24267b (diff) | |
download | nixlib-052632fd15550d83fe98ed599c8504eaad67f0b5.tar nixlib-052632fd15550d83fe98ed599c8504eaad67f0b5.tar.gz nixlib-052632fd15550d83fe98ed599c8504eaad67f0b5.tar.bz2 nixlib-052632fd15550d83fe98ed599c8504eaad67f0b5.tar.lz nixlib-052632fd15550d83fe98ed599c8504eaad67f0b5.tar.xz nixlib-052632fd15550d83fe98ed599c8504eaad67f0b5.tar.zst nixlib-052632fd15550d83fe98ed599c8504eaad67f0b5.zip |
nixos/iwd: workaround for race condition where wlan device disappears
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/networking/iwd.nix | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/nixos/modules/services/networking/iwd.nix b/nixos/modules/services/networking/iwd.nix index 8835f7f9372d..5c1480e7e2fb 100644 --- a/nixos/modules/services/networking/iwd.nix +++ b/nixos/modules/services/networking/iwd.nix @@ -1,12 +1,21 @@ { config, lib, pkgs, ... }: -with lib; - let + inherit (lib) + mkEnableOption mkIf mkOption types + recursiveUpdate; + cfg = config.networking.wireless.iwd; ini = pkgs.formats.ini { }; - configFile = ini.generate "main.conf" cfg.settings; -in { + defaults = { + # without UseDefaultInterface, sometimes wlan0 simply goes AWOL with NetworkManager + # https://iwd.wiki.kernel.org/interface_lifecycle#interface_management_in_iwd + General.UseDefaultInterface = with config.networking.networkmanager; (enable && (wifi.backend == "iwd")); + }; + configFile = ini.generate "main.conf" (recursiveUpdate defaults cfg.settings); + +in +{ options.networking.wireless.iwd = { enable = mkEnableOption "iwd"; @@ -38,10 +47,10 @@ in { ''; }]; - environment.etc."iwd/main.conf".source = configFile; + environment.etc."iwd/${configFile.name}".source = configFile; # for iwctl - environment.systemPackages = [ pkgs.iwd ]; + environment.systemPackages = [ pkgs.iwd ]; services.dbus.packages = [ pkgs.iwd ]; |