From 713b60460fb502651ec1b9f6c92d34ad448346a7 Mon Sep 17 00:00:00 2001 From: Dominik Xaver Hörl Date: Thu, 3 Dec 2020 09:04:39 +0100 Subject: nixos/iwd: add networkd link configuration matching the upstream .link unit file It is meant to fix the race condition between iwd and udev trying to rename the interface. --- nixos/modules/services/networking/iwd.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nixos/modules/services/networking/iwd.nix') diff --git a/nixos/modules/services/networking/iwd.nix b/nixos/modules/services/networking/iwd.nix index 6be67a8b96f..99e5e78badd 100644 --- a/nixos/modules/services/networking/iwd.nix +++ b/nixos/modules/services/networking/iwd.nix @@ -22,6 +22,11 @@ in { systemd.packages = [ pkgs.iwd ]; + systemd.network.links."80-iwd" = { + matchConfig.Type = "wlan"; + linkConfig.NamePolicy = "keep kernel"; + }; + systemd.services.iwd.wantedBy = [ "multi-user.target" ]; }; -- cgit 1.4.1 From 6ea6734f7152793bf5fc06bf78220c682f5f7b46 Mon Sep 17 00:00:00 2001 From: fortuneteller2k Date: Thu, 20 May 2021 07:59:34 +0800 Subject: nixos/iwd: add settings option --- .../from_md/release-notes/rl-2111.section.xml | 9 ++++++ nixos/doc/manual/release-notes/rl-2111.section.md | 2 ++ nixos/modules/services/networking/iwd.nix | 32 ++++++++++++++++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) (limited to 'nixos/modules/services/networking/iwd.nix') diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index 3695997f717..ac38a13bb3d 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -688,6 +688,15 @@ + + + The + networking.wireless.iwd + module has a new + networking.wireless.iwd.settings + option. + + diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index cc5b6bf81ee..5dbcf3631de 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -179,3 +179,5 @@ pt-services.clipcat.enable). - NSS modules which should be queried after `resolved`, `files` and `myhostname`, but before `dns` should use the default priority - NSS modules which should come after `dns` should use mkAfter. + +- The [networking.wireless.iwd](options.html#opt-networking.wireless.iwd.enable) module has a new [networking.wireless.iwd.settings](options.html#opt-networking.wireless.iwd.settings) option. diff --git a/nixos/modules/services/networking/iwd.nix b/nixos/modules/services/networking/iwd.nix index 99e5e78badd..8835f7f9372 100644 --- a/nixos/modules/services/networking/iwd.nix +++ b/nixos/modules/services/networking/iwd.nix @@ -4,8 +4,31 @@ with lib; let cfg = config.networking.wireless.iwd; + ini = pkgs.formats.ini { }; + configFile = ini.generate "main.conf" cfg.settings; in { - options.networking.wireless.iwd.enable = mkEnableOption "iwd"; + options.networking.wireless.iwd = { + enable = mkEnableOption "iwd"; + + settings = mkOption { + type = ini.type; + default = { }; + + example = { + Settings.AutoConnect = true; + + Network = { + EnableIPv6 = true; + RoutePriorityOffset = 300; + }; + }; + + description = '' + Options passed to iwd. + See here for supported options. + ''; + }; + }; config = mkIf cfg.enable { assertions = [{ @@ -15,6 +38,8 @@ in { ''; }]; + environment.etc."iwd/main.conf".source = configFile; + # for iwctl environment.systemPackages = [ pkgs.iwd ]; @@ -27,7 +52,10 @@ in { linkConfig.NamePolicy = "keep kernel"; }; - systemd.services.iwd.wantedBy = [ "multi-user.target" ]; + systemd.services.iwd = { + wantedBy = [ "multi-user.target" ]; + restartTriggers = [ configFile ]; + }; }; meta.maintainers = with lib.maintainers; [ mic92 dtzWill ]; -- cgit 1.4.1