mirror of
https://github.com/simplex-chat/haskell.nix.git
synced 2026-06-03 09:17:32 +00:00
85 lines
2.9 KiB
Markdown
85 lines
2.9 KiB
Markdown
# Command line tools
|
|
|
|
To 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.
|
|
|
|
## stack-to-nix
|
|
|
|
```
|
|
stack-to-nix - a stack to nix converter
|
|
|
|
Usage: stack-to-nix (-o|--output DIR) [--stack-yaml FILE]
|
|
[--ignore-package-yaml] [--cache FILE]
|
|
Generate a Nix expression for a Haskell package using Stack
|
|
|
|
Available options:
|
|
-o,--output DIR Generate output in DIR
|
|
--stack-yaml FILE Override project stack.yaml (default: "stack.yaml")
|
|
--ignore-package-yaml disable hpack run and use only cabal disregarding
|
|
package.yaml existence
|
|
--cache FILE Dependency cache
|
|
file (default: ".stack-to-nix.cache")
|
|
-h,--help Show this help text
|
|
```
|
|
|
|
Use this for stack projects. If a `default.nix` does not exist in the
|
|
output directory, it will create a basic one with a
|
|
[`mkStackPkgSet`](../manually-generating-nix-expressions#Using-Stack) function.
|
|
|
|
!!! note
|
|
If you find that there are missing files which should have been
|
|
generated, remove `.stack-to-nix.cache`
|
|
(The open issue is [#57][cache-issue]).
|
|
|
|
[cache-issue]: https://github.com/input-output-hk/haskell.nix/issues/57
|
|
|
|
## plan-to-nix
|
|
|
|
```
|
|
plan-to-nix - a stack to nix converter
|
|
|
|
Usage: plan-to-nix (-o|--output DIR) [--plan-json FILE] [--cabal-project FILE]
|
|
[--cache FILE]
|
|
Generate a Nix expression for a Haskell package using Cabal
|
|
|
|
Available options:
|
|
-o,--output DIR Generate output in DIR
|
|
--plan-json FILE Override plan.json
|
|
location (default: "dist-newstyle/cache/plan.json")
|
|
--cabal-project FILE Override path to
|
|
cabal.project (default: "cabal.project")
|
|
--cache FILE Dependency cache file (default: ".nix-tools.cache")
|
|
-h,--help Show this help text
|
|
```
|
|
|
|
Use this for Cabal new-build projects (even if you don't have a
|
|
`cabal.project`). Before running, you need to create a plan. For more
|
|
information, see [Cabal Projects](../manually-generating-nix-expressions#Using-Cabal) in the user
|
|
guide.
|
|
|
|
It will create a template `default.nix` in the output directory,
|
|
unless that file already exists.
|
|
|
|
Inside the output directory, there will be another directory
|
|
`.plan.nix`, which contains Nix expressions for all local packages,
|
|
generated by `cabal-to-nix`. The output file `pkgs.nix` refers to
|
|
these files.
|
|
|
|
!!! note
|
|
If you find that there are missing files which should have been
|
|
generated, remove `.nix-tools.cache`
|
|
(The open issue is [#57][cache-issue]).
|
|
|
|
## cabal-to-nix
|
|
|
|
```
|
|
Usage: cabal-to-nix FILE.cabal
|
|
```
|
|
|
|
This writes (to stdout) a [Haskell.nix][] Nix expression for the given
|
|
cabal package.
|
|
|
|
Normally, you do not need to run `cabal-to-nix` yourself. It is called
|
|
by `stack-to-nix` and `plan-to-nix`.
|
|
|
|
[haskell.nix]: https://github.com/input-output-hk/haskell.nix
|