I am using direnv
2.35.0 (and nix-direnv
3.0.6, though the behaviour happens even without use nix
or use flake
) and direnv
insists on printing the environment diff even though I have hide_env_diff = true
in my .config/direnv/direnv.toml
configuration file.
Here's an example transcript in case it's helpful:
shaver on stebe ~
❯ cd -
~/tmp
direnv: loading ~/tmp/.envrc
direnv: export +SLAM
shaver on stebe ~/tmp
❯ cat .envrc
export SLAM=bam
shaver on stebe ~/tmp
❯ cat ~/.config/direnv/direnv.toml
[global]
hide_env_diff = true
How can I properly suppress the printing of the environment diff? When moving into some use flake
directories the list is pretty long and annoying.
If you installed nix-direnv
by setting
programs.direnv.enable=true;
in your configuration.nix
, then this changes your DIRENV_CONFIG
environment variable to /etc/direnv/
, thus never sourcing your direnv.toml
file in your local configuration. Changing this environment variable back directly will not work, however, as configuration to start nix-direnv
is added inside /etc/direnv/direnvrc
.
I solved the problem by adding
environment.etc."direnv/direnv.toml".text = ''
[global]
hide_env_diff = true
'';
to my configuration.nix, which adds the direnv.toml
file with the specified content to /etc/direnv
. You will then have to modify this text if you want to add other options.