From fef7340826e89dc305bb64f00ace42bf1b4b072b Mon Sep 17 00:00:00 2001 From: Bryan Bennett Date: Tue, 8 Mar 2022 16:43:39 -0500 Subject: [PATCH] Use ls to resolve symlink --- direnvrc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/direnvrc b/direnvrc index 3128d36..e6e7e7b 100644 --- a/direnvrc +++ b/direnvrc @@ -159,12 +159,10 @@ use_flake() { tmp_profile_rc=$("${NIX_BIN_PREFIX}nix" print-dev-env \ --extra-experimental-features "nix-command flakes" \ --profile "$tmp_profile" "$@") - # macos does not have realpath - if command -v realpath >/dev/null; then - drv=$(realpath "$tmp_profile") - else - drv=$(perl -e 'use Cwd "abs_path";print abs_path(shift)' "$tmp_profile") - fi + + drv=$(ls -dl "$tmp_profile") + drv=${tmp_profile#*-> } + echo "$tmp_profile_rc" > "$profile_rc" rm -f "$tmp_profile" "$tmp_profile"* _nix_add_gcroot "$drv" "$profile"