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