haslersn / any-nix-shell

fish and zsh support for the nix run and nix-shell environments of the Nix package manager
MIT License
253 stars 17 forks source link

Comparison with `direnv` #31

Open michaelpj opened 9 months ago

michaelpj commented 9 months ago

From reading the README this sounds very similar to what direnv gets me, which is widely used in the Nix community. It would be very helpful to have an explanation of the differences!

thenbe commented 1 month ago

I believe direnv is primarily concerned with automatically triggering certain actions depending on the current directory. Actions such as load/unload environment variables or entering a nix development environment (e.g. use flake).

direnv, as far as I can tell, has no bearing on the type of shell you enter, be it bash, zsh, fish, nushell, etc. The scenario I am most familiar with is nix develop, where the default is always bash. any-nix-shell and similar tools (e.g. nix-your-shell) allow you to change the default shell for those commands that would otherwise always default to bash.