[Nix-dev] Haskell doctest
Richard Wallace
rwallace at thewallacepack.net
Wed Nov 12 00:51:18 CET 2014
Hello all,
We've got a Haskell project that we're using nix to ensure a consistent
build environment. I'm working on adding tests with doctest, and am
running into trouble. Here are the default.nix and shell.nix files we're
using (many dependencies elided for brevity)
# This file was auto-generated by cabal2nix. Please do NOT edit manually!
{ cabal, aeson, lens, doctest,
}:
cabal.mkDerivation (self: {
pname = "hiberico";
version = "1";
src = ./.;
isLibrary = false;
isExecutable = true;
buildDepends = [
aeson lens
];
testDepends = [
doctest aeson lens
];
meta = {
description = "Iberico in Haskell";
license = "unknown";
platforms = self.ghc.meta.platforms;
};
})
# shell.nix
let
nixpkgs = (import <nixpkgs> {}).fetchgit {
url = "git://github.com/NixOS/nixpkgs.git";
rev = "c758ec756b60a2161a5d7369d07d3eb2fe04a5aa";
sha256 = "01x01gwj2pm165sdhb1fxfdzl638kksx79dyadji5f2wp4hssk8m";
};
in
{ system ? builtins.currentSystem
, pkgs ? import nixpkgs { inherit system; }
, haskellPackages ? pkgs.haskellPackages.override {
extension = self: super: {
hiberico = self.callPackage ./. {};
};
}
}:
pkgs.lib.overrideDerivation haskellPackages.hiberico (attrs: {
buildInputs = [
haskellPackages.cabalInstall
] ++ attrs.buildInputs;
})
When I enter the nix-shell (`nix-shell --pure shell.nix`), the environment
seems setup correctly. I can run `cabal configure --enable-tests && cabal
build && cabal test` and it gets to the point where doctest is parsing the
source files and I get
Building hiberico-1...
Preprocessing executable 'hiberico' for hiberico-1...
Preprocessing test suite 'doctests' for hiberico-1...
Running 1 test suites...
Test suite doctests: RUNNING...
src/Topology.hs:11:18:
Could not find module 'Data.Aeson'
Perhaps you meant Data.Version (from base)
Use -v to see a list of the files searched for.
I've added all the dependencies to the doctests suite in the cabal file. Is
there something else I'm missing?
Thanks,
Rich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20141111/e158bbf5/attachment-0001.html
More information about the nix-dev
mailing list