How to correctly cache build-time dependencies using Nix -


A possible adverse edge-case here would be that if you were hacking on i.e. stdenv before and had its build deps in the store, those would get uploaded to the store too eventhough they were never used in the build of the project on your machine.

It’d probably be better and overall more robust to cache all transitive build inputs that are not present on instead.

Any easy way to do that?

I’m not aware of an easier one than iterating through the list of dependencies and querying<long hash>.narinfo.


This should make things even easier:

There is a doc snippet with a nice example showing how to capture both uncached build and runtime deps trivially.