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

Sergey Mironov grrwlf at gmail.com
Wed Oct 12 09:56:18 CEST 2016


Hi.

As far as I understand it correctly,
https://github.com/commercialhaskell/stack/issues/2259 says that Stack
mirroring in Nix is not supported anymore. Instead,
per-compiler-version package sets are (re-)introduced, which are
mostly Hackage-oriented. So compiling Haskell projects is still
possible, as long as .cabal files are provided.

Unfortunately, this is not always the case.

Stack toolset seems to going in the direction of replacing .cabal
entirely. Among other steps, it provides 'hpack' tool which is in fact
a .yaml parser, a replacement for good old .cabals. More, it supports
project hierarchies, making it possible to specify one .yaml file
describing several .cabal-like projects. This approach has its
benefits, so there are users who chose it instead of traditional
cabal.

This is exactly the case I have. 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?

Modern nixpkgs provides `buildStackProject` function which seems to do
the job, but at a closer look, it works only with nix-shell, since it
doesn't prevents stack going online to grab its stuff from the
Internet during build process. Could you please suggest the method of
splitting the stack build process into 'online' and 'offline' parts to
run the build in nix-build environment?

Regards,
Sergey


More information about the nix-dev mailing list