[Nix-dev] nix rebuilds

Kevin Cox kevincox at kevincox.ca
Fri May 12 14:31:00 CEST 2017


On 05/12/2017 01:23 PM, Harmen wrote:
> I'm building a few ruby and node projects with nix. It works well enough, but
> nix does too many rebuilds, also when nothing changed. The question is: how I
> can figure out why it does a rebuild? Maybe some checksum has changed, but can
> I somehow figure out which one?
I suspect that at a bare minimum the ./result symlink has changed.

What I tend to do is use builtins.filterSource in order to ensure I am 
only including paths that I need.

You can see an example at 
https://github.com/kevincox/sog/blob/master/default.nix

src = builtins.filterSource (name: type:
     (lib.hasPrefix (toString ./BUILD) name) ||
     (lib.hasPrefix (toString ./sog) name) ||
     (lib.hasPrefix (toString ./test) name) ||
     (lib.hasPrefix (toString ./tools) name) ||
     (lib.hasPrefix (toString ./WORKSPACE) name)) ./.;


More information about the nix-dev mailing list