git.iko.soy/typeable/stackage2nix
on master help sign in
Add package description
commit7a8989382f316691a4751f0902a38b28278b7375 authorDmitry Bushev <bushevdv@gmail.com> dateMon 26 Jun 2017, 02:04 (9 years ago) parent42fc649
2 files changed+52−1
README.md+52 stack2nix-test−1
README.md+52
@@ -3,3 +3,55 @@
33[![Build Status](https://travis-ci.org/4e6/stack2nix.svg?branch=master)](https://travis-ci.org/4e6/stack2nix)
44
55`stack2nix` converts a single Stack file into a Nix build expression.
6+
7+```
8+stack2nix \
9+ --lts-haskell "$LTS_HASKELL_REPO" \
10+ --all-cabal-hashes "$ALL_CABAL_HASHES_REPO" \
11+ .
12+```
13+
14+`stack2nix` has three required arguments:
15+- `--lts-haskell` - path to [fpco/lts-haskell](https://github.com/fpco/lts-haskell)
16+- `--all-cabal-hashes` - path to [commercialhaskell/all-cabal-hashes](https://github.com/commercialhaskell/all-cabal-hashes)
17+- `.` - path to stack.yaml file or directory
18+
19+Produced Nix derivation split on following files:
20+- packages.nix - Stackage packages set
21+- configuration-packages.nix - compiler configuration
22+- default.nix - Haskell packages set
23+
24+A particular package from result Haskell packages set can be built with:
25+
26+```
27+nix-build -A <package-name>
28+```
29+
30+## Override result derivation
31+
32+Complex projects may require some extra customization.
33+Snippet `override.nix` below is a minimal example of Haskell packages override.
34+
35+```
36+with import <nixpkgs> {};
37+with pkgs.haskell.lib;
38+let haskellPackages = import ./. {};
39+in haskellPackages.override {
40+ overrides = self: super: {
41+ stack2nix = disableSharedExecutables super.stack2nix;
42+ };
43+}
44+```
45+
46+```
47+nix-build -A stack2nix override.nix
48+```
49+
50+`stack2nix` result derivation is a Haskell packages set, constructed the same way as a default Nix `haskellPackages`.
51+For further details and examples on how to work with Haskell packages in Nix, see Nixpkgs manual [User’s Guide to the Haskell Infrastructure](http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure)
52+
53+
54+## Examples
55+
56+For other examples of `stack2nix` usage, see [4e6/stack2nix-examples](https://github.com/4e6/stack2nix-examples) repository.
57+It checks `stack2nix` execution against different public projects.
stack2nix-test−1
@@ -18,6 +18,5 @@ stack exec -- stack2nix \
1818 --lts-haskell "$LTS_HASKELL_DIR" \
1919 --all-cabal-hashes "$ALL_CABAL_HASHES_DIR" \
2020 .
21−set +x
2221
2322nix-build -A stack2nix "$@"