Merge pull request #225 from nix-community/perf-improvements

Perf improvements
This commit is contained in:
Jörg Thalheim 2022-09-03 12:25:43 +01:00 committed by GitHub
commit e37d0f5679
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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")"