Skip to content

Commit 8e23c3d

Browse files
committed
use the new watch-print command of direnv
This is only part of direnv 2.33.0, so we need to bump the minimum. We probably wait to merge this PR until this direnv version is reasonably widely available: https://packages.debian.org/de/sid/direnv
1 parent e8acd40 commit 8e23c3d

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

direnvrc

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ NIX_DIRENV_VERSION=2.5.1
44

55
# min required versions
66
BASH_MIN_VERSION=5.2
7-
DIRENV_MIN_VERSION=2.21.3
7+
DIRENV_MIN_VERSION=2.33.0
88
NIX_MIN_VERSION=2.4
99

1010
_NIX_DIRENV_LOG_PREFIX="nix-direnv: "
@@ -210,19 +210,13 @@ _nix_direnv_watches() {
210210
if [[ -z "${DIRENV_WATCHES-}" ]]; then
211211
return
212212
fi
213-
while IFS= read -r line; do
214-
local regex='"[Pp]ath": "(.+)"$'
215-
if [[ "$line" =~ $regex ]]; then
216-
local path="${BASH_REMATCH[1]}"
217-
if [[ "$path" == "${XDG_DATA_HOME:-${HOME:-/var/empty}/.local/share}/direnv/allow/"* ]]; then
218-
continue
219-
fi
220-
# expand new lines and other json escapes
221-
# shellcheck disable=2059
222-
path=$(printf "$path")
223-
_watches+=("$path")
213+
local allow_dir = "${XDG_DATA_HOME:-${HOME:-/var/empty}/.local/share}/direnv/allow/"
214+
while IFS= read -r -d '' line; do
215+
if [[ "$line" == "$allow_dir"* ]]; then
216+
continue
224217
fi
225-
done < <(direnv show_dump "${DIRENV_WATCHES}")
218+
_watches+=("$line")
219+
done < <(direnv watch-print --null)
226220
}
227221

228222
_nix_direnv_manual_reload=0

0 commit comments

Comments
 (0)