Globally disabling doCheck

Some context: I’d like to rebuild everything from scratch a few times a week (e.g. no substituters). Ideally this is as cheap as possible, and one of the routes to that goal is disabling checkPhase most of the time.

Is there an easy way to globally disable checkPhase and installCheckPhase globally? I tried config.doCheckByDefault = false, but this doesn’t seem to take effect. I’ve introduced an overlay that on a per builder (aka buildRustPackage, buildPythonPackage, etc) basis overrides doCheck and doInstallCheck to false. This seems morally wrong because such changes are both fragile wrt changes to the builders and generally ignored by any derivations that explicitly set doCheck = true; or doInstallCheck = true.

I guess the next option is to overrideAttrs each individual derivation I use and set the flags to false. But, that’s a bit tedious to maintain. Does anyone have a better solution?

I’m also interested in the nixpkgs design choices surrounding this: does anyone have insight into why mkderivation’s doCheck value doesn’t propagate to the individual builders like buildRustPackage? And why doCheck = true; seems somewhat common to set explicitly in a derivation instead of checking if the builder has set doCheck to true/false?

Because that’s already the default value.

Because you have it backwards - the respective builders depend on mkDerivation, so the precedence is in the other direction. It doesn’t matter what mkDerivation’s defaults are if the builder that uses it sets a different default.

If the builder doesn’t set it by default, of course it has to be enabled manually.

The only creative solution I can think of is to overlay mkDerivation to have unset doCheck by default in some early phases, e.g. preConfigure. Maybe even repeat that in all the pre* phases since some packages disable some of the phases. Or add a new custom phase to mkDerivation that does that for you.

You’d also want to do something similar to ignore the installCheckPhase.

2 Likes