I’ve been looking around the forum for tips on how to debug my cache misses. However most of the posts I find are about a specific issue and does not help generic troubleshooting. Those posts are more “give someone a fish” rather than what I’m looking for: “teach someone to fish”. This post is perhaps the most generic I’ve found, but the discussion stops after a bit.
If i change several things at once e.g. add some new packages, update my flake.lock. Then when I run nixos-rebuild there is a lot of cache misses (packages are building from source). Are there any strategies to find what options/customizations are the cause?
The steps I have so far are:
- Get a list of derivations that will be built (currently I’m using
nhfor that) - Use
nix-tree --derivation .#nixosConfigurations.my-system.config.system.build.toplevelto find where the biggest offenders are coming from - Enter the name of the derivation from 1) and traverse up the tree until you find a package that you have explicitly included
- Search hydra for the package and version stated by
nix-tree
Now I see 2 paths based on the information
- The build failed and your
Derivation store pathmatches - This is obvious, you are trying to download a binary that doesn’t exist - The build succeeded and
Derivation store pathdoesn’t match - Your derivation doesn’t match, not sure what to do next
Are there any further steps to find out why in the second path the store path doesn’t match? I’ve tried using nix-diff with little success.