Nix and `direnv` - Nix

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Magnus Therning

Just found out today that they play rather nicely together. Plus there's a direnv package for Emacs too :grinning_face_with_smiling_eyes:

maralorn

I have used lorri before and have settled for simple direnv.

Using a stale version of my shell is rarely what I want. I like it much better to synchronously see when my shell rebuilds. And when I decide I don‘t care to wait for that rebuild I can still "Ctrl+C" it and continue. (While possibly letting the build go throw in a second terminal).

direnv + use_nix works really nicely and doesn‘t need a daemon in the background.

maralorn

One advantage over lorri is that build errors will jump in your face with direnv. I had multiple occasions where I worked for hours with a stale shell because I didn‘t notice lorri failed to build my shell.

Magnus Therning

I have seen mentions of lorri but not looked at it yet.

Valentin Robert

I use lorri but without the daemon: I choose when to run lorri shell to update my env, but I get the GC-root registering that lorri handles :)
(and I don't use the daemon mostly because it sometimes appears to get stuck and fails too silently...)

Torsten Schmits

@Valentin Robert could you expand on that? what happens when you run lorri shell periodically? will it create roots that ensure that nothing pertaining to the current build is garbage collected? how reliable is that?

Valentin Robert

I don't know much, and took it at face value from the claim here https://github.com/target/lorri#garbage-collection-roots and having done some GC runs. Sometimes, things that I did not expect to be collected got collected, but I don't know that this wasn't a mistake on my end!

Your project's nix-env. Contribute to target/lorri development by creating an account on GitHub.
Torsten Schmits

ah, it's a single root. well, I'll give it a try and see!

Alex Chapman

I ran the lorri daemon and direnv on my project for a few days, but lorri seemed to always be using cpu, and filled up my hard drive. Maybe this lorri shell is the answer, because it's annoying to have to rebuild everything after a nix-collect-garbage -d