Skip to content

Commit 1e624b1

Browse files
committed
Address comments; also handled nested .envrcs via source_up_if_exists
1 parent 860c557 commit 1e624b1

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎.envrc‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
use flake
1+
source_up_if_exists
2+
if command -v nix >/dev/null 2>&1; then
3+
use flake
4+
fi
25
source_env_if_exists .envrc.local

‎docs/source/contributor-guide/development_environment.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ The repository's `flake.nix` provides a Nix development shell. Enter it directly
5858
with `nix develop`, or install and configure [direnv](https://direnv.net/) and run
5959
`direnv allow` from the repository root to load it automatically.
6060

61-
Put machine-specific direnv settings in `.envrc.local`. This file is ignored by
62-
Git and loaded after the shared Nix environment so that local settings take
63-
precedence.
61+
The repository's `.envrc` first loads the nearest ancestor `.envrc`, if one
62+
exists, and then loads the shared Nix environment when Nix is installed. Put
63+
project-specific direnv settings in `.envrc.local`. This file is ignored by Git
64+
and loaded last so that local settings take precedence.
65+
66+
If you previously kept personal settings in the repository's `.envrc`, move
67+
only those settings to `.envrc.local`. Do not copy the shared `.envrc`, as doing
68+
so would load the Nix environment twice.
6469

6570
## Windows Setup
6671

0 commit comments

Comments
 (0)