Files
haskell.nix/docs/user-guide-stack.md
T
Moritz Angermann 8ee6fcfba7 Rename pkg-def-overlays to pkg-def-extras (#79)
* Rename pkg-def-overlays to pkg-def-extras

Fixes #75
2019-03-15 11:10:57 +08:00

1.0 KiB

User Guide (stack project)

Here we will look into how to generate the pkgs.nix file for a stack.yaml project. For the full integration please see the User Guide

Using stack-to-nix

With nix-tools in PATH, we can simply run the following command on a stack project:

stack-to-nix -o nix --stack-yaml stack.yaml

This will produce a nix/pkgs.nix file that looks like the following:

{
  resolver = "lts-12.17";
  extras = hackage:
    {
      packages = {
        "o-clock" = hackage.o-clock."0.1.1".revisions.default;
        ...
      } // {
        my-package = ./my-package.nix;
        ...
      };
    };
}

This file contains the stackage resolver, as well as set of extra packages. The extras specifies which extra-deps (here: o-clock-0.1.1) we wanted to add over the stackage snapshot, and what local packages we want (here: my-package).

If you came here from the User Guide, go back and complete the setup.