However, when another laptop tries to connect to it, it’s immediately disconnected and tries to connect again in an infinite loop.
I think we should have a module where you only need to put in the password and an ssid name and then it should work. hostapd should only be an implementation detail.
An interface like services.wifi_hotspot = {wpaPassPhrase = “mysecret”; ssid = “myname”};
Any other configuration options are just line noise as far as I am concerned.
This doesn’t solve your problem declaratively, but I think the easiest option currently available is creating a “shared connection” using network-manager.
Since networking has an overhaul on its way with systemd-networkd anyway, I imagine this might also bring in an easier way to set up a wireless network declaratively.
That aside, I agree it would be nice to have this work simply.
@lheckemann do you know if the overhaul will touch how the firewall works? I have a few grievances how forwarding (isn’t) handled and might put a bit of time in improving it otherwise. is there a discussion somewhere what will be done?
I am using the code below
It allows to configure “shared connection” declaratively, and disallow network-manager to use the virtual interface used by hostapd
I tried your config. I just replaced both occurrences of wpl3s0 by wlan0 and the mac address by the wlan0 mac address. When I build, dnsmasq.service fails to start and this can be found in the journal:
Mar 07 22:22:28 nixos dnsmasq-pre-start[104340]: dnsmasq: syntax check OK.
Mar 07 22:22:28 nixos dnsmasq[104341]: dnsmasq: unknown interface wlan-ap0
Mar 07 22:22:28 nixos dnsmasq[104341]: unknown interface wlan-ap0
Mar 07 22:22:28 nixos dnsmasq[104341]: FAILED to start up
Mar 07 22:22:28 nixos systemd[1]: dnsmasq.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
I somehow got to a point, where I don’t get an error while building. I can connect to the hotspot and use it to ssh into the server, but I can not access the internet with it.
Your config compiles and switch happens with no problem. But the AP is not on. Are there any perquisites? Am I supposed to actually change something, like the mac address?