@@ -233,9 +233,10 @@ in {
233233 path = [ pkgs.wpa_supplicant ];
234234
235235 script = ''
236− if [ -f /etc/wpa_supplicant.conf -a "/etc/wpa_supplicant.conf" != "${configFile}" ]
237− then echo >&2 "<3>/etc/wpa_supplicant.conf present but ignored. Generated ${configFile} is used instead."
236+ if [ -f /etc/wpa_supplicant.conf -a "/etc/wpa_supplicant.conf" != "${configFile}" ]; then
237+ echo >&2 "<3>/etc/wpa_supplicant.conf present but ignored. Generated ${configFile} is used instead."
238238 fi
239+
239240 iface_args="-s -u -D${cfg.driver} -c ${configFile}"
240241 ${if ifaces == [] then ''
241242 for i in $(cd /sys/class/net && echo *); do
@@ -248,6 +249,10 @@ in {
248249 fi
249250 fi
250251 done
252+ if [ -z "$args" ]; then
253+ echo >&2 "<3>No wireless interfaces detected (yet)."
254+ exit 1
255+ fi
251256 '' else ''
252257 args="${concatMapStringsSep " -N " (i: "-i${i} $iface_args") ifaces}"
253258 ''}
@@ -261,7 +266,7 @@ in {
261266
262267 # Restart wpa_supplicant when a wlan device appears or disappears.
263268 services.udev.extraRules = ''
264− ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="/run/current-system/systemd/bin/systemctl try-restart wpa_supplicant.service"
269+ ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="/run/current-system/systemd/bin/systemctl restart wpa_supplicant.service"
265270 '';
266271 };
267272