Files
haskell.nix/docs/reference/commands.md
T
Domen Kožar 2852a9521f Reorganize tutorials (#702)
* fix hackage and stackage to work

* user-guides -> tutorials

* Restructure tutorials

* getting-started: clarify on packages and components

* Update docs/tutorials/development.md

Co-authored-by: Rodney Lorrimar <dev@rodney.id.au>

* getting-started: bail out if cabal.project and stack.yaml are present

* hackage-stackage: delete duplicated content

Co-authored-by: Rodney Lorrimar <dev@rodney.id.au>
2020-06-19 13:37:02 +12:00

2.8 KiB

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 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).

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 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).

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.