Alternative Haskell Infrastructure for Nixpkgs
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
IOHK 032157cfe8 Update Hackage and Stackage 4 years ago
.buildkite Replace collectRunComponents with haskellLib.check (#316) 4 years ago
builder Add selectProjectPackages (#406) 4 years ago
compiler ghc.exactDeps/envDeps built with unpatched ghc (#369) 4 years ago
docs Discuss custom source filters in user guide (#418) 4 years ago
examples Use latest cardano-wallet for testing (#296) 4 years ago
lib fix paths for worktree when sandbox is enabled (#423) 4 years ago
materialized Add support for materializing generated nix files (#356) 4 years ago
mk-local-hackage-repo Overlays (#261) 4 years ago
modules Keep source for component builds (#345) 4 years ago
nix-tools Automatically generate cache for stackage projects (#397) 4 years ago
nixpkgs Run the cross compiled tests on wine (#317) 4 years ago
overlays 19.09 compat (#403) 4 years ago
patches Fix singletons patch (#409) 4 years ago
pkgs Overlays (#261) 4 years ago
scripts Automatically generate cache for stackage projects (#397) 4 years ago
test Update cleanSourceWith based on the latest nixpkgs (#401) 4 years ago
.gitattributes Overlays (#261) 4 years ago
.gitignore More documentation (#179) 4 years ago
COPYING License Apache 2.0 4 years ago Document sha256 annotations for cabalProject in README (#373) 4 years ago
build.nix Use 19.09 nixpkgs pin for update-docs script (#339) 4 years ago Change LLVM versions for ghc-8.6 to LLVM 6 (#385) 4 years ago
ci.nix Drop examples from ci.nix (#341) 4 years ago
config.nix 19.09 compat (#403) 4 years ago
default.nix Overlays (#261) 4 years ago
hackage-src.json Update Hackage and Stackage 4 years ago
mkdocs.yml docs: Add note about shellFor and CABAL_CONFIG (#247) 4 years ago
package-set.nix Replace collectRunComponents with haskellLib.check (#316) 4 years ago
release.nix Enable windows cross for nixpkgs 19.09 on hydra (#410) 4 years ago
shell.nix Cross comp. & callCabalProjectToNix/callStackToNix (#202) 4 years ago
snapshots.nix fix #269. Apply fix to mkStackPkgSet (#310) 4 years ago
stackage-src.json Update Hackage and Stackage 4 years ago
test-ghcjs.nix Overlays (#261) 4 years ago
test-mingw32.nix Overlays (#261) 4 years ago
test-rpi.nix Overlays (#261) 4 years ago
test.nix Overlays (#261) 4 years ago

⚠️ The Overlay branch #261 was merged. haskell.nix is now an overlay and the dependency on iohk-nix was dropped. Please see the updated documentation! Once any remaining issues are resolved, this will mark the 1.0 release of haskell.nix.   warning

Alternative Haskell Infrastructure for Nixpkgs">">

haskell.nix is an experimental new builder for Haskell packages.

It works by automatically translating your Cabal or Stack project and its dependencies into Nix code. It provides IFD (imports from derviation) functions that can minimize the amount of nix code you need to add.

For the documentation, see


For cabal.project project add a default.nix:

{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball
, haskellCompiler ? "ghc865"
  pkgs.haskell-nix.cabalProject {
    src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
    ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler};

Note that you'll need to add a comment specifying the expected sha256 output for your source-repository-packages in your cabal.project file:

  type: git
  subdir:   plugins/backend-editor
  tag: 4956b32f039579a0e7e4fd10793f65b4c77d9044
  --sha256: 03lyb2m4i6p7rpjqarnhsx21nx48fwk6rzsrx15k6274a4bv0pix

For a stack.yaml project add a default.nix:

{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball
  pkgs.haskell-nix.stackProject {
    src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };

To build the library component of a package in the project run:

nix build -f . your-package-name.components.library

To build an executable:

nix build -f . your-package-name.components.exes.your-exe-name

To open a shell for use with `cabal` run:

nix-shell -A shellFor
cabal new-build your-package-name
cabal new-repl your-package-name:library:your-package-name


CI pushes to cachix so you can benefit from the cache if you pin a combination of haskell.nix and nixpkgs built by CI.

You'll need to configure the nix-tools cachix as a substituter for nix and add the public key found at the url to trusted-public-keys.

Related repos

The haskell.nix repository contains the runtime system for building Haskell packages in Nix. It depends on other repos, which are:

  • nix-tools — provides the programs for generating Nix expressions from Haskell projects.
  • hackage.nix — the latest contents of the Hackage databases, converted to Nix expressions.
  • stackage.nix — all of the Stackage snapshots, converted to Nix expressions.

IRC Channel

Join the #haskell.nix channel on to get help or discuss the development of haskell.nix and nix-tools.