on iko/ghcjs-patch-master help sign in
Merge pull request #73 from input-output-hk/rvl/fix-68

docs: Fix mistake in cabal instructions and update stack-to-nix usage

commitfa7d436635064d66b8abf669b5040d647278339f authorRodney Lorrimar <dev@rodney.id.au> dateWed 27 Feb 2019, 09:09 (8 years ago) parentcda3b85414bcab
2 files changed+21−10
docs/user-guide-cabal.md+1−1 docs/user-guide-stack.md+20−9
docs/user-guide-cabal.md+1−1
@@ -11,7 +11,7 @@ Guide](/user-guide)
1111 involved than for a corresponding stack project*.
1212
1313With [nix-tools](https://github.com/input-output-hk/nix-tools) in
14−`PATH`, we can simply run the following command on a stack project:
14+`PATH`, we can simply run the following command on a cabal package:
1515
1616```bash
1717# make sure the cabal project is configured (the plan.json file is generated)
docs/user-guide-stack.md+20−9
@@ -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: o-clock-0.1.1)
3535we wanted to overlay over the stackage snapshot, and what local
3636packages 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.*