tree-sitter.tree-sitter/.envrc
Amaan Qureshi 792bba8dab
nix: support single-checkout and multi-workspace direnv setups
The current `.envrc` unconditionally runs `use flake`, which breaks multi-workspace
jj setups where workspace subdirectories each have their own `.envrc`. Entering a
workspace unloads the root's nix env even when the workspace `.envrc` is blocked,
because direnv always unloads the parent env on any `.envrc` transition.

`source_up_if_exists` re-runs the parent `.envrc` and inherits its nix env in a
multi-workspace setup (fast due to caching). The `IN_NIX_SHELL` guard then skips
`use flake path:.`, which only runs in a plain single checkout where no parent
`.envrc` exists and `IN_NIX_SHELL` is unset.
2026-02-18 00:50:06 -05:00

5 lines
73 B
Plaintext

source_up_if_exists
if [ -z "${IN_NIX_SHELL:-}" ]; then
use flake .
fi