@@ -8,17 +8,20 @@ let
88 ${optionalString cfg.userControlled.enable ''
99 ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=${cfg.userControlled.group}
1010 update_config=1''}
11− ${concatStringsSep "\n" (mapAttrsToList (ssid: networkConfig: let
12− psk = if networkConfig.psk != null
13− then ''"${networkConfig.psk}"''
14− else networkConfig.pskRaw;
15− priority = networkConfig.priority;
11+ ${concatStringsSep "\n" (mapAttrsToList (ssid: config: with config; let
12+ key = if psk != null
13+ then ''"${psk}"''
14+ else pskRaw;
15+ baseAuth = if key != null
16+ then ''psk=${key}''
17+ else ''key_mgmt=NONE'';
1618 in ''
1719 network={
1820 ssid="${ssid}"
19− ${optionalString (psk != null) ''psk=${psk}''}
20− ${optionalString (psk == null) ''key_mgmt=NONE''}
2121 ${optionalString (priority != null) ''priority=${toString priority}''}
22+ ${optionalString hidden "scan_ssid=1"}
23+ ${if (auth != null) then auth else baseAuth}
24+ ${extraConfig}
2225 }
2326 '') cfg.networks)}
2427 '' else "/etc/wpa_supplicant.conf";
@@ -70,6 +73,32 @@ in {
7073 Mutually exclusive with <varname>psk</varname>.
7174 '';
7275 };
76+
77+ auth = mkOption {
78+ type = types.nullOr types.str;
79+ default = null;
80+ example = ''
81+ key_mgmt=WPA-EAP
82+ eap=PEAP
83+ identity="user@example.com"
84+ password="secret"
85+ '';
86+ description = ''
87+ Use this option to configure advanced authentication methods like EAP.
88+ See wpa_supplicant.conf(5) for example configurations.
89+
90+ Mutually exclusive with <varname>psk</varname> and <varname>pskRaw</varname>.
91+ '';
92+ };
93+
94+ hidden = mkOption {
95+ type = types.bool;
96+ default = false;
97+ description = ''
98+ Set this to <literal>true</literal> if the SSID of the network is hidden.
99+ '';
100+ };
101+
73102 priority = mkOption {
74103 type = types.nullOr types.int;
75104 default = null;
@@ -83,6 +112,19 @@ in {
83112 policy, signal strength, etc.
84113 '';
85114 };
115+
116+ extraConfig = mkOption {
117+ type = types.str;
118+ default = "";
119+ example = ''
120+ bssid_blacklist=02:11:22:33:44:55 02:22:aa:44:55:66
121+ '';
122+ description = ''
123+ Extra configuration lines appended to the network block.
124+ See wpa_supplicant.conf(5) for available options.
125+ '';
126+ };
127+
86128 };
87129 });
88130 description = ''
@@ -128,8 +170,8 @@ in {
128170
129171 config = mkIf cfg.enable {
130172 assertions = flip mapAttrsToList cfg.networks (name: cfg: {
131− assertion = cfg.psk == null || cfg.pskRaw == null;
132− message = ''networking.wireless."${name}".psk and networking.wireless."${name}".pskRaw are mutually exclusive'';
173+ assertion = with cfg; count (x: x != null) [ psk pskRaw auth ] <= 1;
174+ message = ''options networking.wireless."${name}".{psk,pskRaw,auth} are mutually exclusive'';
133175 });
134176
135177 environment.systemPackages = [ pkgs.wpa_supplicant ];