stack2nix
automates conversion from Stack configuration file to Nix expressions. The purpose is to map stack.yaml one-to-one into Nix expressions.
stack2nix
high-level workflow:
- Generate stackage snapshot to determine complete fixed version list of packages based on resolver
- apply any additional configuration (local packages, extra dependencies, etc) from
stack.yaml
- generate complete list of dependencies to Nix expressions, replacing upstream
hackage-packages.nix
There are three options. The first - using Nix is recommended. If there are difficulties please file an issue.
- Install Nix.
- Clone this repo.
- Run
nix-build
to build.
- Install Nix.
- Clone this repo.
- Run
stack install --nix
to install.
- Install VirtualBox and Vagrant.
- Clone this repo.
- Run
./scripts/vagrant.sh
and take a coffee break. - If there are no errors, log into the VM:
vagrant ssh
.
Nix expressions generated by stack2nix require NixOS 17.09 or later.
Sometimes it's convenient to build local Haskell packages. Assuming the current directory is a locally maintained fork of Pandoc:
$ stack2nix . > default.nix
$ nix-build -A pandoc
Stack2nix can generate a nix expressions for Haskell packages hosted in git repositories.
$ stack2nix --revision 242e2a064f6a32b22e1599bbfe72e64d7b6203b8 https://github.com/jgm/pandoc.git > demo.nix
$ nix-build -A pandoc demo.nix
Run ./scripts/travis.sh
to build and test.