input-output-hk / haskell.nix

Alternative Haskell Infrastructure for Nixpkgs
https://input-output-hk.github.io/haskell.nix
Apache License 2.0
556 stars 240 forks source link

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

Closed nek0 closed 2 years ago

nek0 commented 4 years ago

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?

angerman commented 4 years ago

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.

nek0 commented 4 years ago

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

dhess commented 4 years ago

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; }
  ];
hamishmack commented 2 years ago

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.