Disabling the testsuite for my own cabal project is easy with cabal2nix
, just supply --no-check
. What about my project's dependencies? How can I disable compiling and running their testuites while building them?
Overriding each dependency (recursively!) with noCheck = false
seems tedious. Is there some kind of overlay mechanism available?
There is indeed! To change something recursively for all packages, you can override the thing that generates all packages, and that's haskellPackages.mkDerivation
. So this is doable with a Haskell package overlay like this:
hself: hsuper: {
mkDerivation = args: hsuper.mkDerivation (args // {
doCheck = false;
});
}
You can also override other arguments from here like this. For example you can disable library profiling builds, which commonly halves the build time:
hself: hsuper: {
mkDerivation = args: hsuper.mkDerivation (args // {
enableLibraryProfiling = false;
});
}
See this section in the manual for more info.
Edit: If you want to use this as a user overlay, you can put the following in ~/.config/nixpkgs/overlays/haskell-no-check.nix
:
self: super: {
haskell = super.haskell // {
packageOverrides = hself: hsuper: {
mkDerivation = args: hsuper.mkDerivation (args // {
doCheck = false;
});
};
};
}
Note that this uses haskell.packageOverrides
, not the somewhat deprecated packageOverrides
in config.nix
.
There are other ways of doing it, but I think in this case this is the best because it applies the change to all Haskell package sets. Unfortunately due to how overriding works, this would clear previous packageOverrides
, which often isn't a problem, but can be. If you need to persist previous ones, then you can do this:
self: super: {
haskell = super.haskell // {
packageOverrides = super.lib.composeExtensions super.haskell.packageOverrides
(hself: hsuper: {
mkDerivation = args: hsuper.mkDerivation (args // {
doCheck = false;
});
});
};
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With