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