diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-05-03 15:14:25 +0200 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-05-07 11:19:19 +0200 |
commit | d92b2b6a1bbd322dd65a8b6f51019610d350046e (patch) | |
tree | 7f7c21927b9cc05676501f297c51eb76b49e326c /nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix | |
parent | 93c9e56b40530cc627d921cfc255c05b495d4017 (diff) | |
parent | 49050352f602fe87d16ff7b2b6a05b79eb20dc6f (diff) | |
download | nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.gz nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.bz2 nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.lz nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.xz nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.tar.zst nixlib-d92b2b6a1bbd322dd65a8b6f51019610d350046e.zip |
Merge remote-tracking branch 'nixpkgs/nixos-unstable-small'
Conflicts: nixpkgs/nixos/modules/services/mail/mailman.nix nixpkgs/nixos/modules/services/mail/public-inbox.nix nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix')
-rw-r--r-- | nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix b/nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix index 4586550ed75e..435cd530c18d 100644 --- a/nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix +++ b/nixpkgs/nixos/modules/services/networking/wpa_supplicant.nix @@ -124,11 +124,20 @@ let fi ''} + # ensure wpa_supplicant.conf exists, or the daemon will fail to start + ${optionalString cfg.allowAuxiliaryImperativeNetworks '' + touch /etc/wpa_supplicant.conf + ''} + # substitute environment variables if [ -f "${configFile}" ]; then ${pkgs.gawk}/bin/awk '{ - for(varname in ENVIRON) - gsub("@"varname"@", ENVIRON[varname]) + for(varname in ENVIRON) { + find = "@"varname"@" + repl = ENVIRON[varname] + if (i = index($0, find)) + $0 = substr($0, 1, i-1) repl substr($0, i+length(find)) + } print }' "${configFile}" > "${finalConfig}" else @@ -172,13 +181,13 @@ let in { options = { networking.wireless = { - enable = mkEnableOption (lib.mdDoc "wpa_supplicant"); + enable = mkEnableOption "wpa_supplicant"; interfaces = mkOption { type = types.listOf types.str; default = []; example = [ "wlan0" "wlan1" ]; - description = lib.mdDoc '' + description = '' The interfaces {command}`wpa_supplicant` will use. If empty, it will automatically use all wireless interfaces. @@ -191,11 +200,11 @@ in { driver = mkOption { type = types.str; default = "nl80211,wext"; - description = lib.mdDoc "Force a specific wpa_supplicant driver."; + description = "Force a specific wpa_supplicant driver."; }; - allowAuxiliaryImperativeNetworks = mkEnableOption (lib.mdDoc "support for imperative & declarative networks") // { - description = lib.mdDoc '' + allowAuxiliaryImperativeNetworks = mkEnableOption "support for imperative & declarative networks" // { + description = '' Whether to allow configuring networks "imperatively" (e.g. via `wpa_supplicant_gui`) and declaratively via [](#opt-networking.wireless.networks). @@ -207,7 +216,7 @@ in { scanOnLowSignal = mkOption { type = types.bool; default = true; - description = lib.mdDoc '' + description = '' Whether to periodically scan for (better) networks when the signal of the current one is low. This will make roaming between access points faster, but will consume more power. @@ -217,7 +226,7 @@ in { fallbackToWPA2 = mkOption { type = types.bool; default = true; - description = lib.mdDoc '' + description = '' Whether to fall back to WPA2 authentication protocols if WPA3 failed. This allows old wireless cards (that lack recent features required by WPA3) to connect to mixed WPA2/WPA3 access points. @@ -230,7 +239,7 @@ in { type = types.nullOr types.path; default = null; example = "/run/secrets/wireless.env"; - description = lib.mdDoc '' + description = '' File consisting of lines of the form `varname=value` to define variables for the wireless configuration. @@ -268,7 +277,7 @@ in { psk = mkOption { type = types.nullOr types.str; default = null; - description = lib.mdDoc '' + description = '' The network's pre-shared key in plaintext defaulting to being a network without any authentication. @@ -286,7 +295,7 @@ in { pskRaw = mkOption { type = types.nullOr types.str; default = null; - description = lib.mdDoc '' + description = '' The network's pre-shared key in hex defaulting to being a network without any authentication. @@ -337,7 +346,7 @@ in { "OWE" "DPP" ]); - description = lib.mdDoc '' + description = '' The list of authentication protocols accepted by this network. This corresponds to the `key_mgmt` option in wpa_supplicant. ''; @@ -351,7 +360,7 @@ in { identity="user@example.com" password="@EXAMPLE_PASSWORD@" ''; - description = lib.mdDoc '' + description = '' Use this option to configure advanced authentication methods like EAP. See {manpage}`wpa_supplicant.conf(5)` @@ -372,7 +381,7 @@ in { hidden = mkOption { type = types.bool; default = false; - description = lib.mdDoc '' + description = '' Set this to `true` if the SSID of the network is hidden. ''; example = literalExpression '' @@ -387,7 +396,7 @@ in { priority = mkOption { type = types.nullOr types.int; default = null; - description = lib.mdDoc '' + description = '' By default, all networks will get same priority group (0). If some of the networks are more desirable, this field can be used to change the order in which wpa_supplicant goes through the networks when selecting a BSS. The @@ -404,7 +413,7 @@ in { example = '' bssid_blacklist=02:11:22:33:44:55 02:22:aa:44:55:66 ''; - description = lib.mdDoc '' + description = '' Extra configuration lines appended to the network block. See {manpage}`wpa_supplicant.conf(5)` @@ -414,7 +423,7 @@ in { }; }); - description = lib.mdDoc '' + description = '' The network definitions to automatically connect to when {command}`wpa_supplicant` is running. If this parameter is left empty wpa_supplicant will use @@ -443,7 +452,7 @@ in { enable = mkOption { type = types.bool; default = false; - description = lib.mdDoc '' + description = '' Allow normal users to control wpa_supplicant through wpa_gui or wpa_cli. This is useful for laptop users that switch networks a lot and don't want to depend on a large package such as NetworkManager just to pick nearby @@ -458,7 +467,7 @@ in { type = types.str; default = "wheel"; example = "network"; - description = lib.mdDoc "Members of this group can control wpa_supplicant."; + description = "Members of this group can control wpa_supplicant."; }; }; @@ -466,7 +475,7 @@ in { type = types.bool; default = lib.length cfg.interfaces < 2; defaultText = literalExpression "length config.${opt.interfaces} < 2"; - description = lib.mdDoc '' + description = '' Whether to enable the DBus control interface. This is only needed when using NetworkManager or connman. ''; @@ -478,7 +487,7 @@ in { example = '' p2p_disabled=1 ''; - description = lib.mdDoc '' + description = '' Extra lines appended to the configuration file. See {manpage}`wpa_supplicant.conf(5)` |