I’m using direnv integration with nix-shell and it makes for a very nice workflow, and I always get the most recent version of all, say, my R packages whenever I do a system --update, which is good.
However it might happen that I leave the code for a couple of months (durnig which I might nix-collect-garbage), go back to it, get a flurry of new package versions, and something doesn’t work anymore.
In order to pinpoint what the problem is, it would be useful to know which was the version of each package that was installed (or rather, linked to the environment) through the default.nix during the last nix-shell invocation.
Is there a way to get that information, so that I can save it to a file and compare later? Something like:
it should be possible to “add a Garbage Collection root” or something like that
if i understand correctly this should prevent nix-collect-garbage removing the dep’s of your shell
The nix-shell options quoted above seem to be silently ignored today. I’m accomplishing something similar by parsing the output of nix show-derivation somewhat laboriously. It would be much nicer for nix tools to have some first-class way to reference a build-time closure.
I would still like to be able to generate the equivalent of a packrat.lock or requirement.txt file on each run, though.
Using these approaches it wouldn’t be easy to find which packages have changed versions (or would it?), while if I had a text file with the versions I would simply be a diff away from knowing which package is the culprit.
Something like nix-store -q for the current nix-shell environment, minus the default one for the user.