Command line tools

To install the command line tools refer to the Installing nix-tools 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 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.