summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2023-12-08 17:39:25 +0530
committersinanmohd <sinan@sinanmohd.com>2023-12-08 18:07:50 +0530
commita8a38a61b362d1ec93ac2d6885ad1102671ae51e (patch)
treec14fb70efb78066459e7c90ce056da3611e77117 /modules
parent1e420a988493c708d5ce5e721ec1e955e2b02412 (diff)
modules/iwd: refactor
Diffstat (limited to 'modules')
-rw-r--r--modules/iwd.nix70
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 ];
}