darwin flake: reloads .envrc on every shell command
Describe the bug
reloads .envrc, printing direnv: loading <cd>/.envrc and direnv: export +..., on every shell command.
if lorri daemon is enabled, cd inside the flake directory reloads it twice.
To Reproduce
- enter flake directory
- run any shell command
Expected behavior
.envrc is loaded once, upon entering flake directory.
Metadata
$ lorri info
Project Shell File: /Users/lukas/labs/zig/flake.nix
Project Garbage Collector Root: /Users/lukas/Library/Caches/com.github.nix-community.lorri.lorri.lorri/gc_roots/0238430c2a5762a8b2777bdf01e7692d/gc_root/shell_gc_root
General:
Lorri User GC Root Dir: /Users/lukas/Library/Caches/com.github.nix-community.lorri.lorri.lorri/gc_roots
Lorri Daemon Socket: /Users/lukas/Library/Caches/com.github.nix-community.lorri.lorri.lorri/daemon.socket
Lorri Daemon Status: `lorri daemon` is not up: Unable to connect to socket at /Users/lukas/Library/Caches/com.github.nix-community.lorri.lorri.lorri/daemon.socket, is the daemon running?
$ uname -a
Darwin Lukass-MBP.lan 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64 arm Darwin
Additional context
Daemon doesn't print anything of interest.
Environment built using this hack, but issue persists when loading cached version with the hack disabled.
Does not reload .envrc on shell.nix variant.
Tested with zsh and bash, configless.
Could you share your flake.nix file? I don't have easy access to a Darwin environment, but maybe I can help debug. You might also capture the output of lorri internal steam-events - it might indicate which files are triggering a rebuild
I reduced it to a minimal setup of a flake with a single devShell without any packages and an otherwise empty directory.
lorri internal stream-events prints nothing of interest:
{"Started":{"nix_file":"/Users/lukas/labs/nix/lorri-minimal/flake.nix","reason":{"FilesChanged":["/Users/lukas/labs/nix/lorri-minimal/flake.nix","/Users/lukas/labs/nix/lorri-minimal/flake.nix"]}}}
{"Completed":{"nix_file":"/Users/lukas/labs/nix/lorri-minimal/flake.nix","rooted_output_paths":{"shell_gc_root":"/Users/lukas/Library/Caches/com.github.nix-community.lorri.lorri.lorri/gc_roots/0bf43fd2018b3fe1a27aecd19b4ce53c/gc_root/shell_gc_root"}}}
It's not rebuilding - it's reevaluating .envrc and reloading the (cached) environment.
(bash and zsh come from nixpkgs-master, not the old versions of macos.)
Interesting. Does direnv report what changed? I think there's ways to get it to. Sorry, I'm in the weird position of having time on my hands but not having my workstation available, so advice is a little vague.
If it's lorri's output, getting successive versions and comparing would be informative
I added the Sponsoring solicited label, since issues on MacOS are a good candidate for sponsoring developer time.