18 cfg = config.networking.wireless.iwd;
19 ini = pkgs.formats.ini { };
21 # without UseDefaultInterface, sometimes wlan0 simply goes AWOL with NetworkManager
22 # https://iwd.wiki.kernel.org/interface_lifecycle#interface_management_in_iwd
23 General.UseDefaultInterface =
24 with config.networking.networkmanager;
25 (enable && (wifi.backend == "iwd"));
27 configFile = ini.generate "main.conf" (recursiveUpdate defaults cfg.settings);
31 options.networking.wireless.iwd = {
32 enable = mkEnableOption "iwd";
34 package = mkPackageOption pkgs "iwd" { };
41 Settings.AutoConnect = true;
45 RoutePriorityOffset = 300;
50 Options passed to iwd.
51 See {manpage}`iwd.config(5)` for supported options.
56 config = mkIf cfg.enable {
59 assertion = !config.networking.wireless.enable;
61 Only one wireless daemon is allowed at the time: networking.wireless.enable and networking.wireless.iwd.enable are mutually exclusive.
66 environment.etc."iwd/${configFile.name}".source = configFile;
69 environment.systemPackages = [ cfg.package ];
71 services.dbus.packages = [ cfg.package ];
73 systemd.packages = [ cfg.package ];
75 systemd.network.links."80-iwd" = {
76 matchConfig.Type = "wlan";
77 linkConfig.NamePolicy = "keep kernel";
80 systemd.services.iwd = {
81 path = [ config.networking.resolvconf.package ];
82 wantedBy = [ "multi-user.target" ];
83 restartTriggers = [ configFile ];
84 serviceConfig.ReadWritePaths = "-/etc/resolv.conf";
88 meta.maintainers = with lib.maintainers; [ dtzWill ];