Nix & Haskell
Creating shell.nix
$ nix-shell -p cabal2nix
[nix-shell:~/Werk/foo]$ cabal2nix --shell . > shell.nix
Running tests
[nix-shell:~/Werk/sfoo]$ runhaskell -isrc -itest test/Spec.hs
Building
$ cabal2nix . > default.nix
$ echo "let pkgs = import <nixpkgs> {}; in pkgs.haskellPackages.callPackage ./default.nix {}" > build.nix
$ nix-build build.nix
$ ./result/bin/foo
For disabling tests in dependencies, I added the following to ~/.nixpkgs/config.nix
:
{
packageOverrides = super: let self = super.pkgs; in
{
noTestsHaskellPackages = self.haskellPackages.override {
overrides = self: super: {
mkDerivation = args: super.mkDerivation (args // {
doCheck = false;
});
};
};
};
}