Skip to content

docs: Update import instructions in user guide #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/user-guide-cabal.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ file as follows:

```nix
let plan = import ./plan.nix; in
{ ... }:
{ pkg-def = plan;
overlay =
{ local-package-a = ./local-package-a.nix;
Expand Down
21 changes: 0 additions & 21 deletions docs/user-guide-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,5 @@ packages. The overlay specifies which `extra-deps` (here: o-clock-0.1.1)
we wanted to overlay over the stackage snapshot, and what local
packages we want (here: my-package).

We will then create the following `nix/default.nix` file:

```nix
{ pkgs ? import <nixpkgs> {} }:

let
haskell = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) { inherit pkgs; };

pkgSet = haskell.mkStackPkgSet {
stack-pkgs = import ./pkgs.nix;
pkg-def-overlays = [];
modules = [];
};

in
pkgSet.config.hsPkgs
```

This generated file is a template, so you can customize it as
necessary.

*If you came here from the [User Guide](/user-guide), go back and
complete the setup.*
51 changes: 20 additions & 31 deletions docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,41 +35,23 @@ let
in
```

Next we will use this to import `haskell.nix`, `hackage.nix` and
`stackage.nix` (if we use a stack project).
Next we will use this to import `haskell.nix`.

**NOTE**: update the `rev` and `sha256` values to the recent ones as
found on GitHub. Especially `hackage.nix` and `stackage.nix` will
evolve with package release on hackage and stackage releases
found on GitHub. Especially `haskell.hackage` and `haskell.stackage`
will evolve with package release on hackage and stackage releases
respectively.

```nix
let
# all packages from hackage as nix expressions
hackage = import (overrideWith "hackage"
(pkgs.fetchFromGitHub { owner = "input-output-hk";
repo = "hackage.nix";
rev = "3180384b563ec7c7b46bca86b3ace0f32d04cde8";
sha256 = "19ndkn8pivli9plwq0wnx1cj126l89yk7jw9a0dj51ic3b2qhlb2";
name = "hackage-exprs-source"; }))
;
# a different haskell infrastructure
haskell = import (overrideWith "haskell"
(pkgs.fetchFromGitHub { owner = "input-output-hk";
repo = "haskell.nix";
rev = "73f733ba8bbd11443dda713d1a2d4b7c50a5d408";
sha256 = "1p2srrxw2lac5krrg35waa251by98r2miwyg6zac9glpg2vmq3ip";
name = "haskell-lib-source"; }))
hackage;

# the set of all stackage snapshots
stackage = import (overrideWith "stackage"
(pkgs.fetchFromGitHub { owner = "input-output-hk";
repo = "stackage.nix";
rev = "2615a4e6b1651215ee400e62fcdcb195062a3d35";
sha256 = "08c8lb8x047hndwm1cb2zxixnjmrswfp5y18xp1v79cjqlva0qj6";
name = "stackage-snapshot-source"; }))
;
haskellLib = pkgs.fetchFromGitHub {
owner = "input-output-hk";
repo = "haskell.nix";
rev = "5180ae9d78756509c81b98b8e6d974e350b15752";
sha256 = "0fbnnvymdp2qb09wlqy6ga8wsyhglx607cjdfg510s1gs756v9yx";
name = "haskell-lib-source";
};
haskell = import (overrideWith "haskell" haskellLib) { inherit pkgs; };
in
```

Expand All @@ -78,10 +60,17 @@ Finally we string this together and produce a package set:
```nix
let
# Import the file you will create in the stack-to-nix or cabal-to-nix step.
my-pkgs = import ./nix/pkgs.nix { inherit stackage; };
my-pkgs = import ./nix/pkgs.nix;

# Stack projects use the mkStackPkgSet helper function
pkgSet = haskell.mkStackPkgSet {
stack-pkgs = my-pkgs;
pkg-def-overlays = [];
modules = [];
};

# Cabal projects use mkPkgSet
pkgSet = haskell.mkPkgSet {
inherit pkgs;
pkg-def = my-pkgs.pkg-def;
pkg-def-overlays = [
# this overlay will provide additional packages
Expand Down