Forcing a package to rebuild

Hello all,

Is anyone aware of a way to force a package to rebuild? I’m trying to optimize a build job by fiddling around with the --cores and --max-jobs settings in Nix, and the corresponding -j setting for gcc. In order to do so, I need to be able to re-run the same build multiple times and compare results. I notice that nix build has a --rebuild option, but that doesn’t seem to force an actual re-build.

Thanks!

There’s a --check option that’ll force one for reproducibility testing

I think that’s just on nix-build, and I’m using flakes/nix build, so I’m not sure if it’s still an option here?

It isn’t. AFAIK rebuild and check do the same thing in the different CLIs, though I don’t think I’ve used the flake version. I know I’ve successfully used check in nix-build.

Yes, you’re right. The --rebuild flag does exactly this. I thought it didn’t, but I must have been using it wrongly before. Thanks.

1 Like