From 792bba8dab8a475fee1bd86ef5eba44ef528bbf2 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Tue, 17 Feb 2026 22:48:23 -0500 Subject: [PATCH] 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. --- .envrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.envrc b/.envrc index 3550a30f2..f0b6459dc 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,4 @@ -use flake +source_up_if_exists +if [ -z "${IN_NIX_SHELL:-}" ]; then + use flake . +fi