Merge pull request #305649 from rnhmjoj/pr-fix-wpa-aux
nixos/wireless: create empty config for imperative setup
This commit is contained in:
commit
23fc571cc3
2 changed files with 29 additions and 0 deletions
|
@ -124,6 +124,11 @@ let
|
||||||
fi
|
fi
|
||||||
''}
|
''}
|
||||||
|
|
||||||
|
# ensure wpa_supplicant.conf exists, or the daemon will fail to start
|
||||||
|
${optionalString cfg.allowAuxiliaryImperativeNetworks ''
|
||||||
|
touch /etc/wpa_supplicant.conf
|
||||||
|
''}
|
||||||
|
|
||||||
# substitute environment variables
|
# substitute environment variables
|
||||||
if [ -f "${configFile}" ]; then
|
if [ -f "${configFile}" ]; then
|
||||||
${pkgs.gawk}/bin/awk '{
|
${pkgs.gawk}/bin/awk '{
|
||||||
|
|
|
@ -113,6 +113,21 @@ import ./make-test-python.nix ({ pkgs, lib, ...}:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imperative = { ... }: {
|
||||||
|
imports = [ ../modules/profiles/minimal.nix ];
|
||||||
|
|
||||||
|
# add a virtual wlan interface
|
||||||
|
boot.kernelModules = [ "mac80211_hwsim" ];
|
||||||
|
|
||||||
|
# wireless client
|
||||||
|
networking.wireless = {
|
||||||
|
enable = lib.mkOverride 0 true;
|
||||||
|
userControlled.enable = true;
|
||||||
|
allowAuxiliaryImperativeNetworks = true;
|
||||||
|
interfaces = [ "wlan1" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Test connecting to the SAE-only hotspot using SAE
|
# Test connecting to the SAE-only hotspot using SAE
|
||||||
machineSae = machineWithHostapd {
|
machineSae = machineWithHostapd {
|
||||||
networking.wireless = {
|
networking.wireless = {
|
||||||
|
@ -185,6 +200,15 @@ import ./make-test-python.nix ({ pkgs, lib, ...}:
|
||||||
assert "Failed to connect" not in status, \
|
assert "Failed to connect" not in status, \
|
||||||
"Failed to connect to the daemon"
|
"Failed to connect to the daemon"
|
||||||
|
|
||||||
|
with subtest("Daemon can be configured imperatively"):
|
||||||
|
imperative.wait_for_unit("wpa_supplicant-wlan1.service")
|
||||||
|
imperative.wait_until_succeeds("wpa_cli -i wlan1 status")
|
||||||
|
imperative.succeed("wpa_cli -i wlan1 add_network")
|
||||||
|
imperative.succeed("wpa_cli -i wlan1 set_network 0 ssid '\"nixos-test\"'")
|
||||||
|
imperative.succeed("wpa_cli -i wlan1 set_network 0 psk '\"reproducibility\"'")
|
||||||
|
imperative.succeed("wpa_cli -i wlan1 save_config")
|
||||||
|
imperative.succeed("grep -q nixos-test /etc/wpa_supplicant.conf")
|
||||||
|
|
||||||
machineSae.wait_for_unit("hostapd.service")
|
machineSae.wait_for_unit("hostapd.service")
|
||||||
machineSae.copy_from_vm("/run/hostapd/wlan0.hostapd.conf")
|
machineSae.copy_from_vm("/run/hostapd/wlan0.hostapd.conf")
|
||||||
with subtest("Daemon can connect to the SAE access point using SAE"):
|
with subtest("Daemon can connect to the SAE access point using SAE"):
|
||||||
|
|
Loading…
Reference in a new issue