mirror of
https://github.com/nix-community/nix-direnv.git
synced 2025-11-08 19:46:11 +01:00
Merge pull request #225 from nix-community/perf-improvements
Perf improvements
This commit is contained in:
commit
e37d0f5679
1 changed files with 8 additions and 8 deletions
16
direnvrc
16
direnvrc
|
|
@ -141,12 +141,8 @@ _nix_argsum_suffix() {
|
|||
}
|
||||
|
||||
nix_direnv_watch_file() {
|
||||
for watch in "$@"; do
|
||||
if [[ -e "${watch}" ]]; then
|
||||
watch_file "${watch}"
|
||||
nix_watches+=("${watch}")
|
||||
fi
|
||||
done
|
||||
watch_file "$@"
|
||||
nix_watches+=("$@")
|
||||
}
|
||||
|
||||
use_flake() {
|
||||
|
|
@ -155,11 +151,15 @@ use_flake() {
|
|||
flake_expr="${1:-.}"
|
||||
flake_dir="${flake_expr%#*}"
|
||||
|
||||
nix_direnv_watch_file ".envrc" "$HOME/.direnvrc" "$HOME/.config/direnv/direnvrc"
|
||||
local files_to_watch
|
||||
files_to_watch=(".envrc" "$HOME/.direnvrc" "$HOME/.config/direnv/direnvrc")
|
||||
|
||||
if [[ -d "$flake_dir" ]]; then
|
||||
nix_direnv_watch_file "$flake_dir/flake.nix" "$flake_dir/flake.lock" "$flake_dir/devshell.toml"
|
||||
files_to_watch+=("$flake_dir/flake.nix" "$flake_dir/flake.lock" "$flake_dir/devshell.toml")
|
||||
fi
|
||||
|
||||
nix_direnv_watch_file "${files_to_watch[@]}"
|
||||
|
||||
local layout_dir profile
|
||||
layout_dir=$(direnv_layout_dir)
|
||||
profile="${layout_dir}/flake-profile$(_nix_argsum_suffix "$flake_expr")"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue