nixpkgs/nixos/modules
rnhmjoj 99e8af51b2
nixos/wireless: use udev to wait for interfaces
I may have finally found a clean solution to the issues[1][2][3] with
the automatic discovery of wireless network interfaces.

[1]: https://github.com/NixOS/nixpkgs/issues/101963
[2]: https://github.com/NixOS/nixpkgs/issues/23196
[3]: https://github.com/NixOS/nixpkgs/pull/125917#issuecomment-856000426

Currently the start script fails right away if no interface is available
by the time it's running, possibly leaving the system without network.
This happens when running a little early in the boot. A solution is to
instead wait for at least one interface to appear before scanning the
/sys/class/net/ directory. This is done here by listening for the right
udev events (from the net/wlan subsystem) using the `udevadm monitor`
command and grep to match its output.

This methods guarantees the availability of at least one interface to
wpa_supplicant, but won't add additional interfaces once it has started.
However, if the current interface is lost, say unplugged, the service is
automatically stopped and will be restarted as soon as a one (not
necessarily the same) is detected. It would be possible make this fully
dynamic by running another service that continously listen for udev
events and manages the main wpa_supplicant daemon, but this is probably
overkill.

I tested the following cases:

  - one interface, starting at boot, w/o predictable naming scheme
  - two interfaces, starting at boot (intel wireless and a usb adapter),
    w/o predictable naming scheme
  - one interface after the system booted, w/o predictable naming scheme
  - two interfaces after the system booted, w/o predictable naming scheme
  - unplugging and plugging back the current interface
2021-08-12 00:31:06 +02:00
..
config Merge pull request #107728 from nessdoor/master 2021-06-15 14:40:21 +02:00
hardware nixos/corectrl: init module 2021-06-11 03:00:29 +03:00
i18n/input-method nixos/fcitx5: autostart with xserver 2021-06-05 09:22:58 +08:00
installer treewide: Use fileSystems.<name>.depends option where necessary 2021-06-08 18:52:02 +02:00
misc nixos/gale: remove 2021-06-10 02:33:10 +02:00
profiles Merge pull request #85073 from hyperfekt/systemd-pstore 2021-05-17 00:00:52 +02:00
programs nixos/x2goserver: put into networking, like xrdp 2021-06-11 08:13:49 +02:00
security nixos/pam_mount: add support for FUSE-filesystems (#126069) 2021-06-08 22:06:28 +02:00
services nixos/wireless: use udev to wait for interfaces 2021-08-12 00:31:06 +02:00
system nixos/luksroot: add bypassWorkqueues (#118114) 2021-05-26 09:43:38 -04:00
tasks Merge pull request #107728 from nessdoor/master 2021-06-15 14:40:21 +02:00
testing treewide: use perl.withPackages when possible 2021-03-31 21:35:37 +02:00
virtualisation nixos/libvirtd: add assertion requiring polkit to be enabled 2021-06-07 15:12:21 +02:00
module-list.nix nixos/ucarp: init 2021-06-15 18:13:31 +02:00
rename.nix quagga: remove 2021-04-22 12:48:48 +02:00