mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-12-08 01:51:09 +01:00
use_flake: use ls to resolve link name
This commit is contained in:
parent
c17645e939
commit
46c42e5983
1 changed files with 2 additions and 6 deletions
8
direnvrc
8
direnvrc
|
|
@ -129,12 +129,8 @@ use_flake() {
|
||||||
tmp_profile_rc=$("${NIX_BIN_PREFIX}nix" print-dev-env \
|
tmp_profile_rc=$("${NIX_BIN_PREFIX}nix" print-dev-env \
|
||||||
--extra-experimental-features "nix-command flakes" \
|
--extra-experimental-features "nix-command flakes" \
|
||||||
--profile "$tmp_profile" "$flake_expr")
|
--profile "$tmp_profile" "$flake_expr")
|
||||||
# macos does not have realpath
|
drv=$(ls -dl "$tmp_profile")
|
||||||
if command -v realpath >/dev/null; then
|
drv=${drv#*-> }
|
||||||
drv=$(realpath "$tmp_profile")
|
|
||||||
else
|
|
||||||
drv=$(perl -e 'use Cwd "abs_path";print abs_path(shift)' "$tmp_profile")
|
|
||||||
fi
|
|
||||||
echo "$tmp_profile_rc" > "$profile_rc"
|
echo "$tmp_profile_rc" > "$profile_rc"
|
||||||
rm -f "$tmp_profile" "$tmp_profile"*
|
rm -f "$tmp_profile" "$tmp_profile"*
|
||||||
_nix_add_gcroot "$drv" "$profile"
|
_nix_add_gcroot "$drv" "$profile"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue