on 2db7ade help sign in
75 lines 2.6 kB history raw
1# stack-to-nix
3```
4stack-to-nix - a stack to nix converter
6Usage: stack-to-nix (-o|--output DIR) [--stack-yaml FILE]
7 [--ignore-package-yaml] [--cache FILE]
8 Generate a Nix expression for a Haskell package using Stack
10Available options:
11 -o,--output DIR Generate output in DIR
12 --stack-yaml FILE Override project stack.yaml (default: "stack.yaml")
13 --ignore-package-yaml disable hpack run and use only cabal disregarding
14 package.yaml existence
15 --cache FILE Dependency cache
16 file (default: ".stack-to-nix.cache")
17 -h,--help Show this help text
18```
20Use this for stack projects. If a `default.nix` does not exist in the
21output directory, it will create a basic one with a
22[`mkStackPkgSet`](../user-guide/stack-projects.md) function.
24!!! note
25 If you find that there are missing files which should have been
26 generated, remove `.stack-to-nix.cache`. (There's an open issue for
27 this).
29# plan-to-nix
31```
32plan-to-nix - a stack to nix converter
34Usage: plan-to-nix (-o|--output DIR) [--plan-json FILE] [--cabal-project FILE]
35 [--cache FILE]
36 Generate a Nix expression for a Haskell package using Cabal
38Available options:
39 -o,--output DIR Generate output in DIR
40 --plan-json FILE Override plan.json
41 location (default: "dist-newstyle/cache/plan.json")
42 --cabal-project FILE Override path to
43 cabal.project (default: "cabal.project")
44 --cache FILE Dependency cache file (default: ".nix-tools.cache")
45 -h,--help Show this help text
46```
48Use this for Cabal new-build projects (even if you don't have a
49`cabal.project`). Before running, you need to create a plan. For more
50information, see [Cabal Projects](../user-guide/cabal-projects.md) in the user
51guide.
53It will create a template `default.nix` in the output directory,
54unless that file already exists.
56Inside the output directory, there will be another directory
57`.plan.nix`, which contains Nix expressions for all local packages,
58generated by `cabal-to-nix`. The output file `pkgs.nix` refers to
59these files.
61Same note as above applies about the cache file.
63# cabal-to-nix
65```
66Usage: cabal-to-nix FILE.cabal
67```
69This writes (to stdout) a [Haskell.nix][] Nix expression for the given
70cabal package.
72Normally, you do not need to run `cabal-to-nix` yourself. It is called
73by `stack-to-nix` and `plan-to-nix`.
75[haskell.nix]: https://github.com/input-output-hk/haskell.nix