diff --git a/.envrc b/.envrc index 3550a30f2de38..6a0e44f6e1876 100644 --- a/.envrc +++ b/.envrc @@ -1 +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/.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..e687b7418bff6 100644 --- a/docs/source/contributor-guide/development_environment.md +++ b/docs/source/contributor-guide/development_environment.md @@ -52,6 +52,21 @@ 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. + +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 ```shell