1# Wireless Networks {#sec-wireless} 2 3For a desktop installation using NetworkManager (e.g., GNOME), you just 4have to make sure the user is in the `networkmanager` group and you can 5skip the rest of this section on wireless networks. 6 7NixOS will start wpa_supplicant for you if you enable this setting: 8 9```nix 10{ networking.wireless.enable = true; } 11``` 12 13NixOS lets you specify networks for wpa_supplicant declaratively: 14 15```nix 16{ 17 networking.wireless.networks = { 18 # SSID with no spaces or special characters 19 echelon = { 20 psk = "abcdefgh"; 21 }; 22 # SSID with spaces and/or special characters 23 "echelon's AP" = { 24 psk = "ijklmnop"; 25 }; 26 # Hidden SSID 27 echelon = { 28 hidden = true; 29 psk = "qrstuvwx"; 30 }; 31 free.wifi = { }; # Public wireless network 32 }; 33} 34``` 35 36Be aware that keys will be written to the nix store in plaintext! When 37no networks are set, it will default to using a configuration file at 38`/etc/wpa_supplicant.conf`. You should edit this file yourself to define 39wireless networks, WPA keys and so on (see wpa_supplicant.conf(5)). 40 41If you are using WPA2 you can generate pskRaw key using 42`wpa_passphrase`: 43 44```ShellSession 45$ wpa_passphrase ESSID PSK 46network={ 47 ssid="echelon" 48 #psk="abcdefgh" 49 psk=dca6d6ed41f4ab5a984c9f55f6f66d4efdc720ebf66959810f4329bb391c5435 50} 51``` 52 53```nix 54{ 55 networking.wireless.networks = { 56 echelon = { 57 pskRaw = "dca6d6ed41f4ab5a984c9f55f6f66d4efdc720ebf66959810f4329bb391c5435"; 58 }; 59 }; 60} 61``` 62 63or you can use it to directly generate the `wpa_supplicant.conf`: 64 65```ShellSession 66# wpa_passphrase ESSID PSK > /etc/wpa_supplicant.conf 67``` 68 69After you have edited the `wpa_supplicant.conf`, you need to restart the 70wpa_supplicant service. 71 72```ShellSession 73# systemctl restart wpa_supplicant.service 74```