[Nix-dev] [Nix-Dev] Packaging a Haskell project using Stack

Peter Simons simons at nospf.cryp.to
Wed Oct 12 16:27:22 CEST 2016


Hi Sergey,

> Instead, per-compiler-version package sets are (re-)introduced, which
> are mostly Hackage-oriented.

FWIW, the compiler-specific package sets have existed for several years,
and they still do. The LTS-Haskell package sets, however, have been
removed.


> So compiling Haskell projects is still possible, as long as .cabal
> files are provided.

I'm not sure what you mean. Nix can compile Haskell packages using a
*Nix* file, it doesn't know about Cabal.


> Stack provides 'hpack' tool which is in fact a .yaml parser, a
> replacement for good old .cabals.

Actually, hpack is a tool that generates Cabal files from simple YAML
input. Stack supports that set transparently, but the build is still
driven by Cabal, of course.


> I am to package Stack project which
>
>   1) depends on old lts-2.21 package set from stackage
>   2) doesn't have .cabals anymore, only .yamls.
>
> The question is basically How to do it?

Run "hpack" to generate the Cabal files. Then run "cabal2nix" to
generate the Nix files. Add those Nix builds to Nixpkgs as explained in
the user's manual at:

  http://nixos.org/nixpkgs/manual/#how-to-create-nix-builds-for-your-own-private-haskell-packages

You will also have to package older versions of other libraries to be
able to build your project, though, because Nixpkgs has moved to LTS 7.3
meanwhile, so many packages suggested by LTS 2.x don't exist in the
default package set any more.

Best regards,
Peter



More information about the nix-dev mailing list