on iko/ghcjs-patch-master help sign in
docs: Update stack-to-nix usage
414bcabRodney Lorrimar
docs/user-guide-stack.md+20−9
@@ -10,10 +10,10 @@ With [nix-tools](https://github.com/input-output-hk/nix-tools) in
10`PATH`, we can simply run the following command on a stack project:
10`PATH`, we can simply run the following command on a stack project:
11
11
12```bash
12```bash
13−stack-to-nix -o nix stack.yaml > nix/.stack-pkgs.nix
13+stack-to-nix -o nix --stack-yaml stack.yaml
14```
14```
15
15
16−This will produce a `nix/.stack-pkgs.nix` file that looks like the following:
16+This will produce a `nix/pkgs.nix` file that looks like the following:
17```nix
17```nix
18{
18{
19 resolver = "lts-12.17";
19 resolver = "lts-12.17";
@@ -23,7 +23,7 @@ This will produce a `nix/.stack-pkgs.nix` file that looks like the following:
23 "o-clock" = hackage.o-clock."0.1.1".revisions.default;
23 "o-clock" = hackage.o-clock."0.1.1".revisions.default;
24 ...
24 ...
25 } // {
25 } // {
26− my-package = ./.stack.nix/my-package.nix;
26+ my-package = ./my-package.nix;
27 ...
27 ...
28 };
28 };
29 };
29 };
@@ -35,15 +35,26 @@ packages. The overlay specifies which `extra-deps` (here: clock-0.1.1)
35we wanted to overlay over the stackage snapshot, and what local
35we wanted to overlay over the stackage snapshot, and what local
36packages we want (here: my-package).
36packages we want (here: my-package).
37
37
38−We will then create the following `nix/pkgs.nix` file:
38+We will then create the following `nix/default.nix` file:
39
39
40```nix
40```nix
41−let stack-pkgs = import ./.stack-pkgs.nix; in
41+{ pkgs ? import <nixpkgs> {} }:
42−{ stackage, ... }:
42+
43−{ pkg-def = stackage.${stack-pkgs.resolver};
43+let
44− inherit (stack-pkgs) overlay;
44+ haskell = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) { inherit pkgs; };
45+
46+ pkgSet = haskell.mkStackPkgSet {
47+ stack-pkgs = import ./pkgs.nix;
48+ pkg-def-overlays = [];
49+ modules = [];
45−}
50+ };
51+
52+in
53+ pkgSet.config.hsPkgs
46```
54```
47
55
56+This generated file is a template, so you can customize it as
57+necessary.
58+
48*If you came here from the [User Guide](/user-guide), go back and
59*If you came here from the [User Guide](/user-guide), go back and
49 complete the setup.*
60 complete the setup.*