Skip to content

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

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 2 commits into from
Feb 26, 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
2 changes: 1 addition & 1 deletion docs/user-guide-cabal.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Guide](/user-guide)
involved than for a corresponding stack project*.

With [nix-tools](https://github.com/input-output-hk/nix-tools) in
`PATH`, we can simply run the following command on a stack project:
`PATH`, we can simply run the following command on a cabal package:

```bash
# make sure the cabal project is configured (the plan.json file is generated)
Expand Down
29 changes: 20 additions & 9 deletions docs/user-guide-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ With [nix-tools](https://github.com/input-output-hk/nix-tools) in
`PATH`, we can simply run the following command on a stack project:

```bash
stack-to-nix -o nix stack.yaml > nix/.stack-pkgs.nix
stack-to-nix -o nix --stack-yaml stack.yaml
```

This will produce a `nix/.stack-pkgs.nix` file that looks like the following:
This will produce a `nix/pkgs.nix` file that looks like the following:
```nix
{
resolver = "lts-12.17";
Expand All @@ -23,7 +23,7 @@ This will produce a `nix/.stack-pkgs.nix` file that looks like the following:
"o-clock" = hackage.o-clock."0.1.1".revisions.default;
...
} // {
my-package = ./.stack.nix/my-package.nix;
my-package = ./my-package.nix;
...
};
};
Expand All @@ -35,15 +35,26 @@ packages. The overlay specifies which `extra-deps` (here: 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/pkgs.nix` file:
We will then create the following `nix/default.nix` file:

```nix
let stack-pkgs = import ./.stack-pkgs.nix; in
{ stackage, ... }:
{ pkg-def = stackage.${stack-pkgs.resolver};
inherit (stack-pkgs) overlay;
}
{ pkgs ? import <nixpkgs> {} }:

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this contradict with overrideWith described in basic user guide?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, actually we need update cabal-to-nix code generation to be more similar to stack-to-nix, and delete those big chunks of boilerplate code in the Setup section.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the proper way to override is with hackageSourceJSON and stackageSourceJSON? If so shouldn't they appear here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a section in the user guide for pinning and overriding pins. But for now, #77.


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.*