summary refs log tree commit diff
path: root/nixos/modules/services/networking/iwd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/networking/iwd.nix')
-rw-r--r--nixos/modules/services/networking/iwd.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/iwd.nix b/nixos/modules/services/networking/iwd.nix
new file mode 100644
index 00000000000..23787bce991
--- /dev/null
+++ b/nixos/modules/services/networking/iwd.nix
@@ -0,0 +1,34 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.networking.wireless.iwd;
+in {
+  options.networking.wireless.iwd.enable = mkEnableOption "iwd";
+
+  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.
+      '';
+    }];
+
+    # for iwctl
+    environment.systemPackages =  [ pkgs.iwd ];
+
+    services.dbus.packages = [ pkgs.iwd ];
+
+    systemd.services.iwd = {
+      description = "Wireless daemon";
+      before = [ "network.target" ];
+      wants = [ "network.target" ];
+      wantedBy = [ "multi-user.target" ];
+
+      serviceConfig.ExecStart = "${pkgs.iwd}/bin/iwd";
+    };
+  };
+
+  meta.maintainers = with lib.maintainers; [ mic92 ];
+}