Direnv + zsh not reacting to change in change to flake.nix

I recently changed my zsh configuration from one based on grml.org - Zsh + powerlevel10k, to one based on https://github.com/romkatv/zsh4humans (which itself includes powerlevel10k).

Before the change, modifying (or touching) flake.nix in a directory with .envrc containing use flake, would result in the environment provided by the flake being updated automatically when the next zsh prompt appears.

After the change, this no longer happens, and I have to exit and re-enter the directory in order to update environment.

What might be responsible for this change? What should I look for in the shell configurations (both of which are huge) in order to fix the the problem?

(I’m not entirely sure that the zsh config change is the culprit, as I’ve been doing a lot of system reconfiguration recently, so there are many moving parts, but trials with old commits of my configurations do seem to be pointing at zsh.)

This sounds like you’ve been using Appendix A. Configuration Options :slight_smile:

It’s implemented like so: home-manager/direnv.nix at e622bad16372aa5ada79a7fa749ec78715dffc54 · nix-community/home-manager · GitHub

Are you sure that’s still being evaluated in your config somewhere? It’s a bit odd that it doesn’t trigger on prompt eval anymore, perhaps your new zsh config overrides what direnv sets up?

Yes, it does, as described near the bottom of this.

And the consequent interference with direnv's watch_file has also been noted.

1 Like

Good sleuthing! I might give this shell a try at some point too, the built-in direnv integration seems nice :slight_smile:

… it would be, if it worked :wink:

But it does seem significantly faster, when entering/exiting directories, compared to the standard one.

I really like the ctrl+r using fzf. I can see this making me much more productive.

Out of the box suggestions+completions (+ fzf, once again) are great.

The keybindings for cd-ing back, forward, up, and down (the latter with fzf integration, once again) seem interesting, though I haven’t got used to using them yet.

And it’s made by the author of powerlevel10k (and integrates it) and solves a problem with p10k which makes a huge mess of the prompt when resizing some terminals.

All in all, lots of very useful stuff.

1 Like
Hosted by Flying Circus.