stackage2nix

Convert Stack files into Nix build instructions.

https://github.com/4e6/stackage2nix#readme

Version on this page:0.3.0
Stackage Nightly 2017-11-21:0.3.0
Latest on Hackage:0.7.2

See all snapshots stackage2nix appears in

BSD-3-Clause licensed by Dmitry Bushev , Benno Fünfstück
Maintained by [email protected]
This version can be pinned in stack with:stackage2nix-0.3.0@sha256:ede2b7a43e1dead64465ce20896e3ded9c18299706767858b44af9660e34143a,3400

stackage2nix

Build Status

stackage2nix converts a Stack file into a Nix Haskell packages set. It creates LTS Stackage packages set, and applies appropriate overrides on top of it.

stackage2nix \
  --lts-haskell "$LTS_HASKELL_REPO" \
  --all-cabal-hashes "$ALL_CABAL_HASHES_REPO" \
  .

stackage2nix has three required arguments:

Produced Nix derivation split on following files:

  • packages.nix - Base Stackage packages set
  • configuration-packages.nix - Compiler configuration
  • default.nix - Final Haskell packages set with all overrides applied

A particular package from result Haskell packages set can be built with:

nix-build -A <package-name>

Runtime dependencies

  • nix-env is required to be on PATH by the distribution-nixpkgs dependency
  • nix-prefetch-git is required on PATH if you have git dependencies in stack.yaml

Override result derivation

Complex projects may require some extra customization. Snippet override.nix below shows a minimal example of how to apply additional overrides on top of Haskell packages set produced by stackage2nix.

with import <nixpkgs> {};
with pkgs.haskell.lib;
let haskellPackages = import ./. {};
in haskellPackages.override {
  overrides = self: super: {
    stackage2nix = disableSharedExecutables super.stackage2nix;
  };
}
nix-build -A stackage2nix override.nix

For more complex overrides and detailed information on how to work with Haskell packages in Nix, see Nixpkgs manual User’s Guide to the Haskell Infrastructure

Examples

For other examples of stackage2nix usage, see 4e6/stackage2nix-examples repository. It verifies stackage2nix by running it on different public projects.

Changes

0.3.0

  • Initial Hackage release
  • Add CHANGELOG.md