Skip to content

Commit 414bcab

Browse files
committed
docs: Update stack-to-nix usage
It changed in input-output-hk/nix-tools#29. Closes #72
1 parent 2956c80 commit 414bcab

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

docs/user-guide-stack.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ With [nix-tools](https://github.com/input-output-hk/nix-tools) in
1010
`PATH`, we can simply run the following command on a stack project:
1111

1212
```bash
13-
stack-to-nix -o nix stack.yaml > nix/.stack-pkgs.nix
13+
stack-to-nix -o nix --stack-yaml stack.yaml
1414
```
1515

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:
1717
```nix
1818
{
1919
resolver = "lts-12.17";
@@ -23,7 +23,7 @@ This will produce a `nix/.stack-pkgs.nix` file that looks like the following:
2323
"o-clock" = hackage.o-clock."0.1.1".revisions.default;
2424
...
2525
} // {
26-
my-package = ./.stack.nix/my-package.nix;
26+
my-package = ./my-package.nix;
2727
...
2828
};
2929
};
@@ -35,15 +35,26 @@ packages. The overlay specifies which `extra-deps` (here: clock-0.1.1)
3535
we wanted to overlay over the stackage snapshot, and what local
3636
packages we want (here: my-package).
3737

38-
We will then create the following `nix/pkgs.nix` file:
38+
We will then create the following `nix/default.nix` file:
3939

4040
```nix
41-
let stack-pkgs = import ./.stack-pkgs.nix; in
42-
{ stackage, ... }:
43-
{ pkg-def = stackage.${stack-pkgs.resolver};
44-
inherit (stack-pkgs) overlay;
45-
}
41+
{ pkgs ? import <nixpkgs> {} }:
42+
43+
let
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 = [];
50+
};
51+
52+
in
53+
pkgSet.config.hsPkgs
4654
```
4755

56+
This generated file is a template, so you can customize it as
57+
necessary.
58+
4859
*If you came here from the [User Guide](/user-guide), go back and
4960
complete the setup.*

0 commit comments

Comments
 (0)