Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the new watch-print command of direnv #433

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions direnvrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ NIX_DIRENV_VERSION=2.5.1

# min required versions
BASH_MIN_VERSION=5.2
DIRENV_MIN_VERSION=2.21.3
DIRENV_MIN_VERSION=2.33.0
NIX_MIN_VERSION=2.4

_NIX_DIRENV_LOG_PREFIX="nix-direnv: "
Expand Down Expand Up @@ -210,19 +210,13 @@ _nix_direnv_watches() {
if [[ -z "${DIRENV_WATCHES-}" ]]; then
return
fi
while IFS= read -r line; do
local regex='"[Pp]ath": "(.+)"$'
if [[ "$line" =~ $regex ]]; then
local path="${BASH_REMATCH[1]}"
if [[ "$path" == "${XDG_DATA_HOME:-${HOME:-/var/empty}/.local/share}/direnv/allow/"* ]]; then
continue
fi
# expand new lines and other json escapes
# shellcheck disable=2059
path=$(printf "$path")
_watches+=("$path")
local allow_dir="${XDG_DATA_HOME:-${HOME:-/var/empty}/.local/share}/direnv/allow/"
while IFS= read -r -d '' line; do
if [[ "$line" == "$allow_dir"* ]]; then
continue
fi
done < <(direnv show_dump "${DIRENV_WATCHES}")
_watches+=("$line")
done < <(direnv watch-print --null)
}

_nix_direnv_manual_reload=0
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.