From 860c557bf27ce6c3450246631d2abaebe5471727 Mon Sep 17 00:00:00 2001 From: Vova Kot Date: Wed, 7 Oct 2026 19:18:03 +0000 Subject: [PATCH 1/2] fix: preserve local direnv settings Load an ignored .envrc.local after the shared Nix environment so contributors can keep machine-specific settings without modifying tracked files. Document the Nix, direnv, and local override workflow in the development environment guide. Fixes #26101. --- .envrc | 1 + .gitignore | 1 + .../contributor-guide/development_environment.md | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/.envrc b/.envrc index 3550a30f2de38..0f414d0890e03 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ use flake +source_env_if_exists .envrc.local diff --git a/.gitignore b/.gitignore index e100fce5601ae..1d2c63ac00fde 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ datafusion/core/benches/data/* # Generated Nix environment hooks .direnv/ +.envrc.local # rat filtered_rat.txt diff --git a/docs/source/contributor-guide/development_environment.md b/docs/source/contributor-guide/development_environment.md index f54ac75d89d7a..69b8fe0eccf10 100644 --- a/docs/source/contributor-guide/development_environment.md +++ b/docs/source/contributor-guide/development_environment.md @@ -52,6 +52,16 @@ Notes: - `protoc` is required to compile DataFusion from source. - Some tests and examples rely on git submodule data being present locally. +## Nix and direnv + +The repository's `flake.nix` provides a Nix development shell. Enter it directly +with `nix develop`, or install and configure [direnv](https://direnv.net/) and run +`direnv allow` from the repository root to load it automatically. + +Put machine-specific direnv settings in `.envrc.local`. This file is ignored by +Git and loaded after the shared Nix environment so that local settings take +precedence. + ## Windows Setup ```shell From 1e624b110d7a7870ad545e604bbbaedbfb11ac32 Mon Sep 17 00:00:00 2001 From: Vova Kot Date: Thu, 8 Oct 2026 13:27:24 +0000 Subject: [PATCH 2/2] Address comments; also handled nested .envrcs via source_up_if_exists --- .envrc | 5 ++++- .../contributor-guide/development_environment.md | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.envrc b/.envrc index 0f414d0890e03..6a0e44f6e1876 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1,5 @@ -use flake +source_up_if_exists +if command -v nix >/dev/null 2>&1; then + use flake +fi source_env_if_exists .envrc.local diff --git a/docs/source/contributor-guide/development_environment.md b/docs/source/contributor-guide/development_environment.md index 69b8fe0eccf10..e687b7418bff6 100644 --- a/docs/source/contributor-guide/development_environment.md +++ b/docs/source/contributor-guide/development_environment.md @@ -58,9 +58,14 @@ The repository's `flake.nix` provides a Nix development shell. Enter it directly with `nix develop`, or install and configure [direnv](https://direnv.net/) and run `direnv allow` from the repository root to load it automatically. -Put machine-specific direnv settings in `.envrc.local`. This file is ignored by -Git and loaded after the shared Nix environment so that local settings take -precedence. +The repository's `.envrc` first loads the nearest ancestor `.envrc`, if one +exists, and then loads the shared Nix environment when Nix is installed. Put +project-specific direnv settings in `.envrc.local`. This file is ignored by Git +and loaded last so that local settings take precedence. + +If you previously kept personal settings in the repository's `.envrc`, move +only those settings to `.envrc.local`. Do not copy the shared `.envrc`, as doing +so would load the Nix environment twice. ## Windows Setup