on 4e100b2 help sign in
84 lines 3.0 kB history raw
1# Command line tools
3To install the command line tools refer to the [Installing nix-tools](https://input-output-hk.github.io/haskell.nix/dev/manually-generating-nix-expressions/) section.
5## stack-to-nix
7```
8stack-to-nix - a stack to nix converter
10Usage: stack-to-nix (-o|--output DIR) [--stack-yaml FILE]
11 [--ignore-package-yaml] [--cache FILE]
12 Generate a Nix expression for a Haskell package using Stack
14Available options:
15 -o,--output DIR Generate output in DIR
16 --stack-yaml FILE Override project stack.yaml (default: "stack.yaml")
17 --ignore-package-yaml disable hpack run and use only cabal disregarding
18 package.yaml existence
19 --cache FILE Dependency cache
20 file (default: ".stack-to-nix.cache")
21 -h,--help Show this help text
22```
24Use this for stack projects. If a `default.nix` does not exist in the
25output directory, it will create a basic one with a
26[`mkStackPkgSet`](../manually-generating-nix-expressions#Using-Stack) function.
28!!! note
29 If you find that there are missing files which should have been
30 generated, remove `.stack-to-nix.cache`
31 (The open issue is [#57][cache-issue]).
33[cache-issue]: https://github.com/input-output-hk/haskell.nix/issues/57
35## plan-to-nix
37```
38plan-to-nix - a stack to nix converter
40Usage: plan-to-nix (-o|--output DIR) [--plan-json FILE] [--cabal-project FILE]
41 [--cache FILE]
42 Generate a Nix expression for a Haskell package using Cabal
44Available options:
45 -o,--output DIR Generate output in DIR
46 --plan-json FILE Override plan.json
47 location (default: "dist-newstyle/cache/plan.json")
48 --cabal-project FILE Override path to
49 cabal.project (default: "cabal.project")
50 --cache FILE Dependency cache file (default: ".nix-tools.cache")
51 -h,--help Show this help text
52```
54Use this for Cabal new-build projects (even if you don't have a
55`cabal.project`). Before running, you need to create a plan. For more
56information, see [Cabal Projects](../manually-generating-nix-expressions#Using-Cabal) in the user
57guide.
59It will create a template `default.nix` in the output directory,
60unless that file already exists.
62Inside the output directory, there will be another directory
63`.plan.nix`, which contains Nix expressions for all local packages,
64generated by `cabal-to-nix`. The output file `pkgs.nix` refers to
65these files.
67!!! note
68 If you find that there are missing files which should have been
69 generated, remove `.nix-tools.cache`
70 (The open issue is [#57][cache-issue]).
72## cabal-to-nix
74```
75Usage: cabal-to-nix FILE.cabal
76```
78This writes (to stdout) a [Haskell.nix][] Nix expression for the given
79cabal package.
81Normally, you do not need to run `cabal-to-nix` yourself. It is called
82by `stack-to-nix` and `plan-to-nix`.
84[haskell.nix]: https://github.com/input-output-hk/haskell.nix