make version sort compatible with busybox sort

There are too many cases where people have non-coreutils versions in there PATH.
This commit is contained in:
Jörg Thalheim 2023-12-21 09:22:13 +01:00
parent 2cb4a9d83e
commit ced8704eff

View File

@ -38,7 +38,7 @@ _nix() {
_require_version() {
local cmd=$1 version=$2 required=$3
if ! printf "%s\n" "$required" "$version" | sort --check=quiet --version-sort; then
if ! printf "%s\n" "$required" "$version" | LC_ALL=C sort -c -V 2>/dev/null; then
_nix_direnv_fatal \
"minimum required $(basename "$cmd") version is $required (installed: $version)"
fi