Automatically Run nix-shell After Navigating to a Directory

I have a shell.nix file in a project directory that sets up all of my dependencies. Is there a way to have bash automatically run “nix-shell” from the terminal when I cd to that directory? It would be nice to have one less thing to remember whenever I’m working with that project :slight_smile:

1 Like

You’re looking for direnv: https://direnv.net/

There are a few options for integration with nix-shell, but the easiest is use nix in .envrc

4 Likes

Aww, sweetness! Thank you so much for your quick reply.