Description
A possibly big improvement for caching of build results (especially combined with content-addressing), could be having a single derivation per Haskell module.
This would allow caching to be much more granular, and small changes would only cause small rebuilds in CI.
Projects like https://github.com/matthewbauer/ghc-nix and https://github.com/awakesecurity/cabal2ninja are relevant.
The core issue is that the derivation graph depends on the result of previous derivations.
Dynamic derivations would have been the perfect tool for this, however, the PR has seemingly stalled for quite some time due to upstream communication issues (NixOS/nix#4628).
Another tool that can achieve the same thing effectively is IFD, albeit as noted in #1522 , this is problematic, however, perhaps fixing Nix would be enough?