danfran / hcoord

Easily convert between latitude/longitude, Universal Transverse Mercator (UTM) and Ordnance Survey (OSGB) references with Haskell.
Other
5 stars 2 forks source link

Use hpack-dhall so that nix builds don't need libraryToolDepends = [ hpack ]. #6

Open philderbeast opened 6 years ago

philderbeast commented 6 years ago

Using package.yaml is problematic for me building projects depending on hcoord in nix;

{ mkDerivation, base, data-default, hlint, hpack, HUnit, ieee754
, mtl, stdenv
}:
mkDerivation {
  pname = "hcoord";
  version = "2.0.0";
  src = ../.stack2cabal/hcoord;
  postUnpack = "sourceRoot+=/hcoord; echo source root reset to $sourceRoot";
  libraryHaskellDepends = [ base mtl ];
  libraryToolDepends = [ hpack ];
  testHaskellDepends = [ base data-default hlint HUnit ieee754 mtl ];
  doHaddock = false;
  doCheck = false;
  preConfigure = "hpack";
  homepage = "https://github.com/danfran/hcoord#readme";
  description = "Short synopsis";
  license = stdenv.lib.licenses.bsd3;
}
builder for '/nix/store/qgpjlq7aaqj4s85bihb55rwgrxvxfr74-hpack-0.29.7.drv' failed with exit code 1; last 10 log lines:
  11 | import qualified Distribution.SPDX.License as SPDX
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  src/Hpack/License.hs:12:1: error:
      Could not find module ‘Distribution.Parsec.Class’
      Perhaps you meant Distribution.ParseUtils (from Cabal-2.0.1.0)
      Use -v to see a list of the files searched for.
     |
  12 | import           Distribution.Parsec.Class (eitherParsec)
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cannot build derivation '/nix/store/yrr61jchkp3dphwhlg3r6xacbmhchq4g-hcoord-2.0.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/sq6mgsp89d4ap0p52gwh0mbfpmx96nhk-hcoord-utm-2.0.0.drv': 1 dependencies couldn't be built

I now prefer to use package.dhall to generate the .cabal file and commit this to source control. This would drop the need for nix to build hpack and remove libraryToolDepends = [ hpack ]; from the hcoord derivation.