@@ -88,26 +88,6 @@ nix_direnv_watch_file() {
88
88
watch_file "$@"
89
89
}
90
90
91
- _nix_direnv_watches() {
92
- local -n _watches=$1
93
- if [[ -z ${DIRENV_WATCHES-} ]]; then
94
- return
95
- fi
96
- while IFS= read -r line; do
97
- local regex='"[Pp]ath": "(.+)"$'
98
- if [[ $line =~ $regex ]]; then
99
- local path="${BASH_REMATCH[1]}"
100
- if [[ $path == "${XDG_DATA_HOME:-${HOME:-/var/empty}/.local/share}/direnv/allow/"* ]]; then
101
- continue
102
- fi
103
- # expand new lines and other json escapes
104
- # shellcheck disable=2059
105
- path=$(printf "$path")
106
- _watches+=("$path")
107
- fi
108
- done < <($direnv show_dump "${DIRENV_WATCHES}")
109
- }
110
-
111
91
_devenv_watches() {
112
92
local path=$1
113
93
local -n _watches=$2
@@ -140,20 +120,18 @@ use_devenv() {
140
120
fi
141
121
fi
142
122
143
- # Watch the default files
123
+ # Watch the default files.
124
+ # Even if evaluation fails, these files should still trigger a reload.
144
125
watch_file "${default_watches[@]}"
145
126
146
127
# Fetch and watch files that affect the env
147
128
local env_watches
148
129
_devenv_watches "$env_deps_path" env_watches
149
130
watch_file "${env_watches[@]}"
150
131
151
- # Fetch all files that direnv is currently watching
152
- local watches
153
- _nix_direnv_watches watches
154
-
132
+ # Build the environment
155
133
local env
156
- if ! env=$("${DEVENV_BIN}" print-dev-env --quiet ); then
134
+ if ! env=$("${DEVENV_BIN}" print-dev-env); then
157
135
log_error "failed to build the devenv environment. devenv.nix may contain errors. see above."
158
136
exit 0
159
137
fi
@@ -163,9 +141,6 @@ use_devenv() {
163
141
_devenv_watches "$env_deps_path" env_watches
164
142
watch_file "${env_watches[@]}"
165
143
166
- # Fetch the final watches
167
- local watches
168
- _nix_direnv_watches watches
169
-
144
+ # Import the environment
170
145
_nix_import_env "$env"
171
146
}
0 commit comments