4 ms·
It's possible to bring something like `ccache` into your system's Nix sandbox. However, that change in the sandbox means all your packages have different hashes
by slabity 3y ago
It's possible to bring something like `ccache` into your system's Nix sandbox. However, that change in the sandbox means all your packages have different hashes and you lose the ability to pull from upstream caches. The result would be rebuilding every single package when trying to update your system. Not a fun time.
The preferred way to do this is to override `stdenv` with `ccacheStdenv` on the individual packages that would actually benefit from the compile-time caching. Such as for large packages that you already have overrides for, or for nightly packages that get updated extremely frequently and don't have the chance to be cached upstream (such as firefox-nightly). The NixOS Wiki has a pretty good article on this: https://nixos.wiki/wiki/CCache https://nixos.wiki/wiki/CCache
I personally use this for any packages I override in an overlay to reduce build times significantly.