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
README.org 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
changelog.md 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

README.org

⚠️ 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

https://badge.buildkite.com/d453edcd29bd2f8f3f3b32c9b7d6777a33773d9671c37a6ccc.svg?branch=master">https://badge.buildkite.com/d453edcd29bd2f8f3f3b32c9b7d6777a33773d9671c37a6ccc.svg?branch=master https://img.shields.io/buildkite/c8d5a20d3ff0f440f82adb9190b43c16c91e5e47e8adfa867a/master.svg?label=nightly%20updates">https://img.shields.io/buildkite/c8d5a20d3ff0f440f82adb9190b43c16c91e5e47e8adfa867a/master.svg?label=nightly%20updates

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 https://input-output-hk.github.io/haskell.nix/.

Quickstart

For cabal.project project add a default.nix:

{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
, 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:

source-repository-package
  type: git
  location: https://github.com/input-output-hk/iohk-monitoring-framework
  subdir:   plugins/backend-editor
  tag: 4956b32f039579a0e7e4fd10793f65b4c77d9044
  --sha256: 03lyb2m4i6p7rpjqarnhsx21nx48fwk6rzsrx15k6274a4bv0pix

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

{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
}:
  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

Cache

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 irc.freenode.net to get help or discuss the development of haskell.nix and nix-tools.