resolve symbolic links to nixpkgs

Fixes version detection if nixpkgs is a symbolic link into the nix
store.
This commit is contained in:
Gaute Ravndal 2025-06-14 20:00:19 +02:00
parent 5e729f239f
commit 1425ff4592

View file

@ -361,7 +361,7 @@ use_nix() {
local layout_dir path version
layout_dir=$(direnv_layout_dir)
if path=$(_nix eval --impure --expr "<nixpkgs>" 2>/dev/null); then
if path=$(realpath -e "$(_nix eval --impure --expr "<nixpkgs>" 2>/dev/null)"); then
if [[ -f "${path}/.version-suffix" ]]; then
version=$(<"${path}/.version-suffix")
elif [[ -f "${path}/.git/HEAD" ]]; then