Nix: Skipping unit tests when installing a Haskell package
nixpkgs
reorganized things since the accepted answer was posted and there is a new function for disabling tests. You now wrap any Haskell package with the pkgs.haskell.lib.dontCheck
function to disable tests. Here is an example Nix expression from one of my Haskell projects where I had to disable tests for the shared-memory
dependency when building on OS X:
{ pkgs ? import <nixpkgs> {}, compiler ? "ghc7103" }:
pkgs.haskell.packages.${compiler}.callPackage ./my-project.nix
{ shared-memory =
let shared-memory = pkgs.haskell.packages.${compiler}.shared-memory;
in if pkgs.stdenv.isDarwin
then pkgs.haskell.lib.dontCheck shared-memory
else shared-memory;
}
An alternative answer, addressing your concern from a different angle, is to build your packages with testing on a more powerful machine. Then when needed copy the closure to the remote host.
This works well if you are on the same architecture and the software in question is not tightly coupled to any hardware which is different on the two machines.
Read about how to share packages between machines in the nix manual.
This is nice feature which is enabled nix's approach to package management. I have often used this feature in reverse, using more powerful remote machines to build copious amounts of software for my local machine.
I see you trying to use disableTest
found in haskell-package.nix
to remove testing from the lens packages. I would have to do some testing to tell you exactly why it is not meeting your needs.
I have disabled testing in general overriding the cabal
package in config.nix
to cabalNoTest
. This overrides the cabal
package used by the rest of the haskell packages turning off testing.
This is how I normally write it:
{
packageOverrides = pkgs: with pkgs; {
# ...other customizations...
haskellPackages = haskellPackages.override {
extension = self : super : {
cabal = pkgs.haskellPackages.cabalNoTest;
};
};
};
}