Greetings! I am trying to configure an access point on NixOS. This is my current config:
{ lib, pkgs, ... }:
let
wifi = "wlan0";
ipAddress = "10.23.45.1";
prefixLength = 24;
servedAddressRange = "10.23.45.2,10.23.45.150,12h";
ssid = "palosiot";
wifiPassword = "hovno134";
in {
# todo only open needed ports
networking.firewall.trustedInterfaces = [ wifi ];
networking.networkmanager.unmanaged = [ wifi ];
networking.dhcpcd.denyInterfaces = [ wifi ];
networking.interfaces."${wifi}".ipv4.addresses = [{
address = ipAddress;
prefixLength = prefixLength;
}];
services.hostapd = {
enable = true;
interface = wifi;
hwMode = "g";
ssid = ssid;
/* wpaPassphrase = wifiPassword; */
wpa = false;
};
services.dnsmasq = {
enable = true;
extraConfig = ''
# Only listen to routers' LAN NIC. Doing so opens up tcp/udp port 53 to
# localhost and udp port 67 to world:
interface=${wifi}
# Explicitly specify the address to listen on
listen-address=${ipAddress}
# Dynamic range of IPs to make available to LAN PC and the lease time.
# Ideally set the lease time to 5m only at first to test everything works okay before you set long-lasting records.
dhcp-range=${servedAddressRange}
'';
};
}
The service seems to be fine. This is output of journalctl -ru hostapd.service
:
-- Journal begins at Tue 1980-01-01 01:00:00 CET, ends at Thu 2022-03-17 17:46:20 CET. --
Mar 17 17:46:14 nixpi hostapd[1815]: wlan0: AP-ENABLED
Mar 17 17:46:14 nixpi hostapd[1815]: wlan0: interface state UNINITIALIZED->ENABLED
Mar 17 17:46:13 nixpi systemd[1]: Started hostapd wireless AP.
But no AP is detected by either my phone or laptop.