haskell.nix icon indicating copy to clipboard operation
haskell.nix copied to clipboard

Package cabal-doctest missing when calling plan-to-nix

Open nek0 opened this issue 5 years ago • 3 comments

HI,

When building an environment for a multi-package project I have to use plan-to-nix, according to the user handbook. When doing so, the package cabal-doctest seems not to be included into the package definitions of pkgs.nix and the build fails with:

error: Neither the Haskell package set or the Nixpkgs package set contain the package: cabal-doctest (build tool dependency).

If this is a system dependency:
You may need to augment the system package mapping in haskell.nix so that it can be found.

If this is a Haskell dependency:
If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.

I'm not using stack, just plain cabal, to build my projects and I updated the package definitions.

Can somebody have a look into this matter, please?

nek0 avatar Jan 05 '20 12:01 nek0

I believe this is related to #388. What I assume that is happening is that you have a build-type: Custom in your .cabal file and a Setup.hs that depends on cabal-doctest. However cabal-doctest is not(?) properly listed in the build-depends/setup-depends? And thus the plan doesn't contain cabal-doctest and subsequently when trying to build the custom Setup.hs we fail to find cabal-doctest for it.

angerman avatar Jan 06 '20 03:01 angerman

none of my projects uses build-type: Custom, so I don't know, where this comes from...

nek0 avatar Jan 07 '20 14:01 nek0

I had the same issue in my project and was able to work around it by adding this to my haskell-nix.cabalProject derivation, per https://github.com/input-output-hk/haskell.nix/issues/221:

  modules = [
    { reinstallableLibGhc = true; }
  ];

dhess avatar Feb 20 '20 12:02 dhess

reinstallableLibGhc is now the default and I think cabal-doctest support works reasonably well now. See https://github.com/input-output-hk/haskell.nix/tree/master/test/cabal-doctests for an example.

hamishmack avatar Sep 20 '22 10:09 hamishmack