stdenv: bump required Bash version from 4 to 5

Currently stdenv requires Bash 4.x that was released in 2009. This
change bumps the required version to Bash 5.x (2019, 5 years ago).

See https://mywiki.wooledge.org/BashFAQ/061 for more details.

Using a relatively modern Bash version allows us to rely on newer
features (e.g. ${var@a}) and remove workarounds for older quirks (e.g.
https://stackoverflow.com/a/7577209, “old bash empty array problem”).
Note that many setup hooks are using features added after 4.0 version,
e.g. makeWrapper uses ${var@Q} from 4.4, but some even require >5.0,
e.g. cargoBuildHook uses ${var@U} from 5.1.
This commit is contained in:
Ivan Trubach
2024-09-09 15:22:11 +03:00
parent 14a81042cb
commit 799d0c8a7d
+2 -2
View File
@@ -4,9 +4,9 @@ __nixpkgs_setup_set_original=$-
set -eu
set -o pipefail
if [[ -n "${BASH_VERSINFO-}" && "${BASH_VERSINFO-}" -lt 4 ]]; then
if [[ -n "${BASH_VERSINFO-}" && "${BASH_VERSINFO-}" -lt 5 ]]; then
echo "Detected Bash version that isn't supported by Nixpkgs (${BASH_VERSION})"
echo "Please install Bash 4 or greater to continue."
echo "Please install Bash 5 or greater to continue."
exit 1
fi