git.iko.soy/typeable/stackage2nix
on master help sign in
Update docs
4adaee4Dmitry Bushev
CHANGELOG.md+2−2
@@ -1,5 +1,4 @@
1# 0.3.0
1# 0.3.0
2−
3- Initial Hackage release
2- Initial Hackage release
4- Add CHANGELOG.md
3- Add CHANGELOG.md
5
4
@@ -18,7 +17,8 @@
18 with latest revision available on Hackage. This may help when Cabal fails to
17 with latest revision available on Hackage. This may help when Cabal fails to
19 resolve dependencies of extra-deps, and dependences are fixed in the latest
18 resolve dependencies of extra-deps, and dependences are fixed in the latest
20 revision
19 revision
21−- Upd override of stackage packages generated by default
20+- Upd by default stackage2nix generates override of pre-generated Stackage
21+ packages set.
22- Upd generated Stackage packages with `doCheck` and `runHaddock` enabled by
22- Upd generated Stackage packages with `doCheck` and `runHaddock` enabled by
23 default
23 default
24- Remove `--do-check-stackage` flag (enabled by default)
24- Remove `--do-check-stackage` flag (enabled by default)
README.md+44−41
@@ -3,73 +3,76 @@
3[![Build Status](https://travis-ci.org/typeable/stackage2nix.svg?branch=master)](https://travis-ci.org/typeable/stackage2nix)
3[![Build Status](https://travis-ci.org/typeable/stackage2nix.svg?branch=master)](https://travis-ci.org/typeable/stackage2nix)
4
4
5`stackage2nix` converts a Stack file into a Nix Haskell packages set.
5`stackage2nix` converts a Stack file into a Nix Haskell packages set.
6−It creates LTS Stackage packages set, and applies appropriate overrides on top of it.
7
6
8−## Install
7+# Create Nix build from stack.yaml
9
8
10−You can install `stackage2nix` from the Nix expression:
9+## Generate targets from stack.yaml only
11
10
12```
11```
13−nix-env -i -f ./nix/stackage2nix
12+stackage2nix .
14```
13```
15
14
16−It provides pre-configured wrapper around the raw executable with runtime
15+Command creates file `default.nix` which overrides `haskell.packages.stackage`
17−`PATH` and all auxiliary flags set up.
16+packages set. Currently Nixpkgs maintains only Hackage packages, but you can
18−
17+use [4e6/nixpkgs-stackage](https://github.com/4e6/nixpkgs-stackage) overlay that
19−## Build project
18+adds LTS Stackage packages.
20
19
21−Generate derivations from `stack.yaml` config using Nix wrapper:
20+Build package with overlay installed:
22
21
23−``` bash
22+```
24−stackage2nix ./stack.yaml
23+nix-build -A stackage2nix
25```
24```
26
25
27−if you're using the raw executable, you should supply additional flags. See
26+## Generate Stackage packages for the build
28−section 'Flags' below for details.
29
27
30−This command will result in a Haskell packages set, similar to
28+If you don't want to use Stackage overlay, stackage2nix can generate required
31−`pkgs.haskell.packages.<compiler>`, containing only packages that are required
29+packages with `--with-stackage-closure` flag.
32−to build targets listed in `stackage.yaml`. To build a package run:
33
30
34``` bash
31``` bash
35−nix-build -A my-package
32+stackage2nix \
33+ --all-cabal-hashes /path/to/commercialhaskell/all-cabal-hashes \
34+ --lts-haskell /path/to/fpco/lts-haskell \
35+ --with-stackage-closure
36+ ./stack.yaml
36```
37```
37
38
38−## Build stackage
39+To generate Stackage packages, you should supply additional
40+`--all-cabal-hashes` and `--lts-haskell` flags that points to
41+[commercialhaskell/all-cabal-hashes](https://github.com/commercialhaskell)
42+checked out to `hackage` branch and
43+[fpco/lts-haskell](https://github.com/fpco/lts-haskell) respectively.
39
44
40−Generate complete Stackage packages set from resolver:
45+You can use stackage2nix wrapper from `nix` directory that adds required flags:
41
46
42−``` bash
43−stackage2nix --resolver lts-9.0
44```
47```
48+nix-env -i -f ./nix/stackage2nix
49+stackage2nix --with-stackage ./stack.yaml
50+```
51+
52+This command will produce `packages.nix` and `configuration-packages.nix`
53+Stackage packages and its override in `default.nix`
45
54
46−## Flags
55+## Generate full Stackage
56+
57+`--with-stackage` parameter generates full Stackage lts in addition to the
58+targets from `stack.yaml`
47
59
48```
60```
49−stackage2nix \
61+nix-env -i -f ./nix/stackage2nix
50− --lts-haskell "$LTS_HASKELL_REPO" \
62+stackage2nix --with-stackage ./stack.yaml
51− --all-cabal-hashes "$ALL_CABAL_HASHES_REPO" \
52− .
53```
63```
54
64
55−`stackage2nix` has three required arguments:
65+## Generate Stackage from LTS resolver
56−- `--lts-haskell` - path to [fpco/lts-haskell](https://github.com/fpco/lts-haskell)
57−- `--all-cabal-hashes` - path to [commercialhaskell/all-cabal-hashes](https://github.com/commercialhaskell/all-cabal-hashes) checked out to `hackage` branch
58−- `.` - path to stack.yaml file or directory
59−
60−Produced Nix derivation split on following files:
61−- packages.nix - Base Stackage packages set
62−- configuration-packages.nix - Compiler configuration
63−- default.nix - Final Haskell packages set with all overrides applied
64
66
65−A particular package from result Haskell packages set can be built with:
67+You can also generate only Stackage packages from the resolver:
66
68
67```
69```
68−nix-build -A <package-name>
70+nix-env -i -f ./nix/stackage2nix
71+stackage2nix --resolver lts-10.0
69```
72```
70
73
71−See also the [blog post](https://blog.typeable.io/posts/2017-08-24-stackage2nix.html)
74+This command will produce Stackage packages `packages.nix`, packages config
72−about history and motivation behind the project.
75+`configuration-packages.nix` and a Nix Haskell packages set `default.nix`.
73
76
74## Runtime dependencies
77## Runtime dependencies
75
78
@@ -87,7 +90,7 @@ overrides on top of Haskell packages set produced by `stackage2nix`.
87
90
88```
91```
89with import <nixpkgs> {};
92with import <nixpkgs> {};
90−with pkgs.haskell.lib;
93+with haskell.lib;
91let haskellPackages = import ./. {};
94let haskellPackages = import ./. {};
92in haskellPackages.override {
95in haskellPackages.override {
93 overrides = self: super: {
96 overrides = self: super: {
@@ -104,7 +107,7 @@ For more complex overrides and detailed information on how to work with Haskell
104
107
105## Tests
108## Tests
106
109
107−Integration tests that build stackage2nix form different stack configs:
110+Integration tests that build stackage2nix form different yaml configs:
108
111
109```
112```
110STACKAGE_REPO=<path/to/stackage/repo> \
113STACKAGE_REPO=<path/to/stackage/repo> \