1Here we will look into how to generate the `pkgs.nix` file for a
2`stack.yaml` project. For the full integration see the
3[previous page](./projects.md).
7With [nix-tools installed](../user-guide.md), we can simply run the
8following command on a stack project:
11stack-to-nix --output . --stack-yaml stack.yaml
14This will produce a `pkgs.nix` file that looks like the following:
17 resolver = "lts-12.17";
21 "o-clock" = hackage.o-clock."0.1.1".revisions.default;
24 my-package = ./my-package.nix;
31This file contains the stackage resolver, as well as set of extra
32packages. The extras specifies which `extra-deps` (here:
33`o-clock-0.1.1`) we wanted to add over the stackage snapshot, and what
34local packages we want (here: `my-package`).
36## Creating the package set
38Import the generated `pkgs.nix` and pass to
39[`mkStackPkgSet`](../reference/library.md#mkstackpkgset) to
40instantiate a package set.
45 # Import the Haskell.nix library,
46 haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
47 nixpkgs = import haskellNix.sources.nixpkgs-1909 haskellNix.nixpkgsArgs;
48 haskell = nixpkgs.haskell-nix;
50 # Instantiate a package set using the generated file.
51 pkgSet = haskell.mkStackPkgSet {
52 stack-pkgs = import ./pkgs.nix;
53 pkg-def-overlays = [];
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list