diff options
-rw-r--r-- | modules/iwd.nix | 70 |
1 files changed, 28 insertions, 42 deletions
diff --git a/modules/iwd.nix b/modules/iwd.nix index 23b740a..3b11368 100644 --- a/modules/iwd.nix +++ b/modules/iwd.nix @@ -48,49 +48,35 @@ in }; }; - config = lib.mkMerge [ - (mkIf cfg.enable { - assertions = [{ - assertion = !config.networking.wireless.enable; - message = '' - Only one wireless daemon is allowed at the time: networking.wireless.enable and networking.wireless.iwd.enable are mutually exclusive. - ''; - }]; - - environment.etc."iwd/${configFile.name}".source = configFile; - - # for iwctl - environment.systemPackages = [ cfg.package ]; - services.dbus.packages = [ cfg.package ]; - systemd.packages = [ cfg.package ]; - - systemd.network.links."80-iwd" = { - matchConfig.Type = "wlan"; - linkConfig.NamePolicy = "keep kernel"; - }; + config = mkIf cfg.enable { + assertions = [{ + assertion = !config.networking.wireless.enable; + message = '' + Only one wireless daemon is allowed at the time: networking.wireless.enable and networking.wireless.iwd.enable are mutually exclusive. + ''; + }]; - systemd.services.iwd = { - wantedBy = [ "multi-user.target" ]; - restartTriggers = [ configFile ]; - }; - }) - - ( - let - needResolv = cfg.enable - && lib.hasAttrByPath [ "Network" "NameResolvingService" ] cfg.settings - && cfg.settings.Network.NameResolvingService == "resolvconf"; - in - mkIf needResolv { - environment.systemPackages = [ pkgs.openresolv ]; - - systemd.services.iwd = { - path = [ pkgs.openresolv ]; - serviceConfig.ReadWritePaths = "/etc/resolv.conf"; - }; - } - ) - ]; + environment.etc."iwd/${configFile.name}".source = configFile; + + # for iwctl + environment.systemPackages = [ cfg.package ]; + + services.dbus.packages = [ cfg.package ]; + + systemd.packages = [ cfg.package ]; + + systemd.network.links."80-iwd" = { + matchConfig.Type = "wlan"; + linkConfig.NamePolicy = "keep kernel"; + }; + + systemd.services.iwd = { + path = [ config.networking.resolvconf.package ]; + wantedBy = [ "multi-user.target" ]; + restartTriggers = [ configFile ]; + serviceConfig.ReadWritePaths = "-/etc/resolv.conf"; + }; + }; meta.maintainers = with lib.maintainers; [ dtzWill ]; } |