input-output-hk / stack2nix

Generate nix expressions for Haskell projects
MIT License
99 stars 32 forks source link

Generated stack2nix output file doesn't contain tree-diff #131

Open nh2 opened 6 years ago

nh2 commented 6 years ago

When running stack2nix 0.2 on a project using resolver: lts-9.1 (succeeds) and then trying to build the output package:

error: anonymous function at /nix/store/c79p3krp7li3rnc6mfjaar0n82kkxf3k-cabal2nix-Cabal/default.nix:1:1 called without required argument 'tree-diff', at /nix/store/5nj7vgd7spdcvxs47gpv58nqjs76vsla-source/pkgs/development/haskell-modules/make-package-set.nix:88:27
% cat /nix/store/c79p3krp7li3rnc6mfjaar0n82kkxf3k-cabal2nix-Cabal/default.nix
{ mkDerivation, array, base, base-compat, base-orphans, binary
, bytestring, containers, deepseq, Diff, directory, filepath
, integer-logarithms, mtl, optparse-applicative, parsec, pretty
, process, QuickCheck, stdenv, tagged, tar, tasty, tasty-golden
, tasty-hunit, tasty-quickcheck, text, time, transformers
, tree-diff, unix
}:
mkDerivation {
  pname = "Cabal";
  version = "2.2.0.1";
  src = /nix/store/z64nmjm5rlgdjk44qchkmia6mjhim8in-cabal-dedupe-src;
  setupHaskellDepends = [ mtl parsec ];
  libraryHaskellDepends = [
    array base binary bytestring containers deepseq directory filepath
    mtl parsec pretty process text time transformers unix
  ];
  testHaskellDepends = [
    array base base-compat base-orphans bytestring containers deepseq
    Diff directory filepath integer-logarithms optparse-applicative
    pretty process QuickCheck tagged tar tasty tasty-golden tasty-hunit
    tasty-quickcheck text tree-diff
  ];
  doCheck = false;
  homepage = "http://www.haskell.org/cabal/";
  description = "A framework for packaging Haskell software";
  license = stdenv.lib.licenses.bsd3;
}

In this case, Cabal's test suite depends on tree-diff but the generated stack2nix haskellPackages output file doesn't contain tree-diff.

nh2 commented 6 years ago

And that's especially silly because doCheck = false; so it doesn't need the dep in the first place.

nh2 commented 6 years ago

Looks like I can work around it by adding tree-diff = null to the generated stack2nix output file.

domenkozar commented 6 years ago

I think this can only be solved with #111 - so that we use stack information to render packages.