Skip to content

Commit 662f2d1

Browse files
rnhmjojgithub-actions[bot]
authored andcommitted
nixos/wireless: make wireless.interfaces mandatory
This is the only way to solve issue #101963, for now. (cherry picked from commit 030a521)
1 parent 3776ceb commit 662f2d1

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

nixos/doc/manual/release-notes/rl-2105.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@
181181
<para>GNOME desktop environment was upgraded to 40, see the release notes for <link xlink:href="https://help.gnome.org/misc/release-notes/40.0/">40.0</link> and <link xlink:href="https://help.gnome.org/misc/release-notes/3.38/">3.38</link>. The <code>gnome3</code> attribute set has been renamed to <code>gnome</code> and so have been the NixOS options.</para>
182182
</listitem>
183183

184+
<listitem>
185+
<para>
186+
Enabling wireless networking now requires specifying at least one network
187+
interface using <xref linkend="opt-networking.wireless.interfaces"/>.
188+
This is to avoid a race condition with the card initialisation (see
189+
<link xlink:href="https://github.com/NixOS/nixpkgs/issues/101963">issue
190+
#101963</link> for more information).
191+
</para>
192+
</listitem>
184193
<listitem>
185194
<para>
186195
If you are using <option>services.udev.extraRules</option> to assign

nixos/modules/services/networking/wpa_supplicant.nix

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ in {
4040
default = [];
4141
example = [ "wlan0" "wlan1" ];
4242
description = ''
43-
The interfaces <command>wpa_supplicant</command> will use. If empty, it will
44-
automatically use all wireless interfaces.
43+
The interfaces <command>wpa_supplicant</command> will use.
4544
'';
4645
};
4746

@@ -220,7 +219,14 @@ in {
220219
};
221220

222221
config = mkIf cfg.enable {
223-
assertions = flip mapAttrsToList cfg.networks (name: cfg: {
222+
assertions = [
223+
{ assertion = cfg.interfaces != [];
224+
message = ''
225+
No network interfaces for wpa_supplicant have been configured.
226+
Please, specify at least one using networking.wireless.interfaces.
227+
'';
228+
}
229+
] ++ flip mapAttrsToList cfg.networks (name: cfg: {
224230
assertion = with cfg; count (x: x != null) [ psk pskRaw auth ] <= 1;
225231
message = ''options networking.wireless."${name}".{psk,pskRaw,auth} are mutually exclusive'';
226232
});
@@ -255,20 +261,7 @@ in {
255261
then echo >&2 "<3>/etc/wpa_supplicant.conf present but ignored. Generated ${configFile} is used instead."
256262
fi
257263
iface_args="-s -u -D${cfg.driver} ${configStr}"
258-
${if ifaces == [] then ''
259-
for i in $(cd /sys/class/net && echo *); do
260-
DEVTYPE=
261-
UEVENT_PATH=/sys/class/net/$i/uevent
262-
if [ -e "$UEVENT_PATH" ]; then
263-
source "$UEVENT_PATH"
264-
if [ "$DEVTYPE" = "wlan" -o -e /sys/class/net/$i/wireless ]; then
265-
args+="''${args:+ -N} -i$i $iface_args"
266-
fi
267-
fi
268-
done
269-
'' else ''
270-
args="${concatMapStringsSep " -N " (i: "-i${i} $iface_args") ifaces}"
271-
''}
264+
args="${concatMapStringsSep " -N " (i: "-i${i} $iface_args") ifaces}"
272265
exec wpa_supplicant $args
273266
'';
274267
};

0 commit comments

Comments
 (0)