I’m using a Nix flake with direnv (nix-direnv). My flake contains nixSettings
, including a bash-prompt
and some extra-trusted-substituters
/extra-trusted-public-keys
settings. I would like these settings to be accepted automatically whenever the nix shell is loaded via direnv.
If I run nix develop --accept-flake-config
the flake settings are applied, but navigating into the directory and loading the environment via direnv ignores the flake config.
These are the contents of my .envrc
file:
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
use flake . --accept-flake-config
Is it possible to make direnv accept the flake config? It’s critical that my dev environment always apply the flake settings, so the bash prompt indicates that users are inside the develop shell and to prevent them needing to configure the extra substituters in nix.conf
.