The caching of nix-shell seems to be completely undocumented, so rather than get into the weeds of the source code, I’m asking here. I run a simple command to get a specific version of the R application, but if I haven’t run it in a while, it always makes a network request to github to fetch nixpkgs. How can I tell nix-shell to just use the cached copy it’s already downloaded?
nix-shell -p R -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/057f9aecfb71c4437d2b27d3323df7f93c010b7e.tar.gz
The simplest option would be to create a GC root so you don’t need to re-download nixpkgs.
I personally like nix-direnv for this scenario since it’d create the gc root and automatically enter the desired environment when you’re in the directory for the project that needs such a shell.