mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-12-11 03:21:14 +01:00
Merge pull request #308 from pinselimo/check-nix-version-directly
Check nix version directly
This commit is contained in:
commit
9eda67e796
1 changed files with 4 additions and 2 deletions
6
direnvrc
6
direnvrc
|
|
@ -24,8 +24,10 @@ _nix_direnv_preflight () {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! "${NIX_BIN_PREFIX}nix-shell" --extra-experimental-features '' --version 2>/dev/null >&2; then
|
nixversion=$("${NIX_BIN_PREFIX}"nix --version)
|
||||||
log_status "nix-direnv: nix version is older than the required 2.4."
|
[[ "$nixversion" =~ ([0-9]+)[^0-9]*([0-9]+)[^0-9]*([0-9]+)? ]]
|
||||||
|
if [[ "${BASH_REMATCH[1]}" -lt "2" || "${BASH_REMATCH[1]}" -eq "2" && "${BASH_REMATCH[2]}" -lt "4" ]]; then
|
||||||
|
log_status "nix-direnv: nix version ${BASH_REMATCH[0]} is older than the required 2.4."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue