NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.46k stars 13.66k forks source link

services.wireless and services.hostapd should conflict? #137221

Open edrex opened 3 years ago

edrex commented 3 years ago

enabling services.wireless and services.hostapd at the same time causes them to fight over the device, predictably.

Maybe the modules could throw an error if they're both enabled for the same device?

It seems wpa_supplicant scans for all wireless interfaces by default so the device isn't explicit in the config, but then I guess hostapd on any interface should conflict.

I'm pretty new to nix - if this doesn't make any sense let me know :)

rnhmjoj commented 3 years ago

Yes, it makes sense to add an assertion for this case. I should be able to add this, either to hostapd or the wpa_supplicant module.

edrex commented 3 years ago

I've learned that there's some nuance here: it may be desirable to have wpa_supplicant installed but not enabled at startup to allow switching between AP and station mode without rebuilding, like this. So maybe the assertion would just be a hinderance?

rnhmjoj commented 3 years ago

My idea was to check if services.hostapd.interface is in wireless.interfaces, so it would still allows you to run both hostapd and wpa_supplicant on different interfaces. If you want to switch between the two on a single interface, I'm not sure. Maybe just issue a warning?

edrex commented 3 years ago

iwd conflicts with wpa_supplicant: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/networking/iwd.nix#L34-L39

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info