If you use nix-shell, you probably have noticed that it has quite a long startup time (half a second or even more depending on nix expressions used). It may be annoying or even not suitable for some use-cases.
So, I made cached-nix-shell, a caching layer for nix-shell featuring instant startup time on subsequent runs. The design goal is to make a fast drop-in replacement for nix-shell, including support of shebang scripts and non-interactive commands (i.e. nix-shell --run ...).
I like that you use a LD_PRELOAD hook to trace all the file accesses. Lorri overrides builtins like import and readFile with traces and then scans the evaluation output instead.
@xzfc - you probably want this GitHub - target/lorri: Your project's nix-env
(I also made own version, but then found lorri, it’s really lot better and it already has been made progress with core nix prople putting their time on it, recommend)