on iko/ghcjs-patch-master help sign in
Merge pull request #77 from input-output-hk/rvl/user-guide-fixes

docs: Update import instructions in user guide

commitde64d0c510b8c406baf357552d3658bda163ebfa authorRodney Lorrimar <dev@rodney.id.au> dateSun 10 Mar 2019, 16:08 (8 years ago) parent3c78fdaa3c51fa
3 files changed+20−53
docs/user-guide-cabal.md−1 docs/user-guide-stack.md−21 docs/user-guide.md+20−31
docs/user-guide-cabal.md−1
@@ -49,7 +49,6 @@ file as follows:
4949
5050```nix
5151let plan = import ./plan.nix; in
52−{ ... }:
5352{ pkg-def = plan;
5453 overlay =
5554 { local-package-a = ./local-package-a.nix;
docs/user-guide-stack.md−21
@@ -35,26 +35,5 @@ 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/default.nix` file:
39−
40−```nix
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
54−```
55−
56−This generated file is a template, so you can customize it as
57−necessary.
58−
5938*If you came here from the [User Guide](/user-guide), go back and
6039 complete the setup.*
docs/user-guide.md+20−31
@@ -35,41 +35,23 @@ let
3535in
3636```
3737
38−Next we will use this to import `haskell.nix`, `hackage.nix` and
39−`stackage.nix` (if we use a stack project).
38+Next we will use this to import `haskell.nix`.
4039
4140**NOTE**: update the `rev` and `sha256` values to the recent ones as
42− found on GitHub. Especially `hackage.nix` and `stackage.nix` will
43− evolve with package release on hackage and stackage releases
41+ found on GitHub. Especially `haskell.hackage` and `haskell.stackage`
42+ will evolve with package release on hackage and stackage releases
4443 respectively.
4544
4645```nix
4746let
48− # all packages from hackage as nix expressions
49− hackage = import (overrideWith "hackage"
50− (pkgs.fetchFromGitHub { owner = "input-output-hk";
51− repo = "hackage.nix";
52− rev = "3180384b563ec7c7b46bca86b3ace0f32d04cde8";
53− sha256 = "19ndkn8pivli9plwq0wnx1cj126l89yk7jw9a0dj51ic3b2qhlb2";
54− name = "hackage-exprs-source"; }))
55− ;
56− # a different haskell infrastructure
57− haskell = import (overrideWith "haskell"
58− (pkgs.fetchFromGitHub { owner = "input-output-hk";
59− repo = "haskell.nix";
60− rev = "73f733ba8bbd11443dda713d1a2d4b7c50a5d408";
61− sha256 = "1p2srrxw2lac5krrg35waa251by98r2miwyg6zac9glpg2vmq3ip";
62− name = "haskell-lib-source"; }))
63− hackage;
64−
65− # the set of all stackage snapshots
66− stackage = import (overrideWith "stackage"
67− (pkgs.fetchFromGitHub { owner = "input-output-hk";
68− repo = "stackage.nix";
69− rev = "2615a4e6b1651215ee400e62fcdcb195062a3d35";
70− sha256 = "08c8lb8x047hndwm1cb2zxixnjmrswfp5y18xp1v79cjqlva0qj6";
71− name = "stackage-snapshot-source"; }))
72− ;
47+ haskellLib = pkgs.fetchFromGitHub {
48+ owner = "input-output-hk";
49+ repo = "haskell.nix";
50+ rev = "5180ae9d78756509c81b98b8e6d974e350b15752";
51+ sha256 = "0fbnnvymdp2qb09wlqy6ga8wsyhglx607cjdfg510s1gs756v9yx";
52+ name = "haskell-lib-source";
53+ };
54+ haskell = import (overrideWith "haskell" haskellLib) { inherit pkgs; };
7355in
7456```
7557
@@ -78,10 +60,17 @@ Finally we string this together and produce a package set:
7860```nix
7961let
8062 # Import the file you will create in the stack-to-nix or cabal-to-nix step.
81− my-pkgs = import ./nix/pkgs.nix { inherit stackage; };
63+ my-pkgs = import ./nix/pkgs.nix;
64+
65+ # Stack projects use the mkStackPkgSet helper function
66+ pkgSet = haskell.mkStackPkgSet {
67+ stack-pkgs = my-pkgs;
68+ pkg-def-overlays = [];
69+ modules = [];
70+ };
8271
72+ # Cabal projects use mkPkgSet
8373 pkgSet = haskell.mkPkgSet {
84− inherit pkgs;
8574 pkg-def = my-pkgs.pkg-def;
8675 pkg-def-overlays = [
8776 # this overlay will provide additional packages