In other distributions I was able to successfully use ccache
to evade most of rebuild time for C and C++ projects. It pays out especially when one applies small code changes. Nice thing is that most of the time ccache can be enabled transparently without build process change.
I’m not sure how good cache nits are for nix builds given that underlying store paths are moving around after even small derivation changes and given that nix does quite a bit og magic under gcc
wrapper. If those details could be made to work reliably that would not require changing original derivations much to get the benefits of caching. And probably to get hits even at times when ninja would still trigger full rebuilds.