How to tell in advance which deps will come from binary cache

Generally if I do a nix build and it ends up, for example, building ghc rather than fetching it from a binary cache, It’s because I’ve done something wrong in my flake.nix, and I need to edit it. I never want to be doing that, it takes too long.

So what I want to know is, how do I know in advance whether I’ve screwed it up? I don’t want to be 10 minutes into the build, and then I glance over and find the sneaky bastard trying to get away with building ghc behind my back again.

Is there some general way of asking how much of a build will come from binary caches, and how much I will be building myself, in advance of actually performing it?

5 Likes

--dry-run should do the trick for you

6 Likes

The stable CLI also usually prints “These paths will be built” and “These paths will be fetched” before starting to do just that…

Nice, thanks! It looks like that flag doesn’t exist for nix develop, is there some equivalent? Maybe there’s some nix build devShell --dry-run command?