1#+STARTUP: showall hidestars
3** :warning: Please use [[iohk.cachix.org]] instead of [[nix-tools.cachix.org]] :warning:
5* Alternative Haskell Infrastructure for Nixpkgs
7[[https://buildkite.com/input-output-hk/haskell-dot-nix][https://badge.buildkite.com/d453edcd29bd2f8f3f3b32c9b7d6777a33773d9671c37a6ccc.svg?branch=master]]
8[[https://buildkite.com/input-output-hk/haskell-dot-nix-nightly-updates][https://img.shields.io/buildkite/c8d5a20d3ff0f440f82adb9190b43c16c91e5e47e8adfa867a/master.svg?label=nightly%20updates]]
10=haskell.nix= is an experimental new builder for Haskell packages.
12It works by automatically translating your Cabal or Stack project and
13its dependencies into Nix code. It provides IFD (imports from derviation)
14functions that can minimize the amount of nix code you need to add.
16For the documentation, see https://input-output-hk.github.io/haskell.nix/.
20For =cabal.project= project add a =default.nix=:
24 # Fetch the latest haskell.nix and import its default.nix
25 haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
26 # haskell.nix provides access to the nixpkgs pins which are used by our CI, hence
27 # you will be more likely to get cache hits when using these.
28 # But you can also just use your own, e.g. '<nixpkgs>'
29 nixpkgsSrc = haskellNix.sources.nixpkgs-1909;
30 # haskell.nix provides some arguments to be passed to nixpkgs, including some patches
31 # and also the haskell.nix functionality itself as an overlay.
32 nixpkgsArgs = haskellNix.nixpkgsArgs;
34{ pkgs ? import nixpkgsSrc nixpkgsArgs
35, haskellCompiler ? "ghc865"
37# 'cabalProject' generates a package set based on a cabal.project (and the corresponding .cabal files)
38pkgs.haskell-nix.cabalProject {
39 # 'cleanGit' cleans a source directory based on the files known by git
40 src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
41 ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler};
45Note that you'll need to add a comment specifying the expected sha256
46output for your =source-repository-packages= in your =cabal.project=
50source-repository-package
52 location: https://github.com/input-output-hk/iohk-monitoring-framework
53 subdir: plugins/backend-editor
54 tag: 4956b32f039579a0e7e4fd10793f65b4c77d9044
55 --sha256: 03lyb2m4i6p7rpjqarnhsx21nx48fwk6rzsrx15k6274a4bv0pix
58For a =stack.yaml= project add a =default.nix=:
62 haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
63 nixpkgsSrc = haskellNix.sources.nixpkgs-1909;
64 nixpkgsArgs = haskellNix.nixpkgsArgs;
66{ pkgs ? import nixpkgsSrc nixpkgsArgs
68pkgs.haskell-nix.stackProject {
69 src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
73To build the library component of a package in the project run:
76nix build -f . your-package-name.components.library
79To build an executable:
82nix build -f . your-package-name.components.exes.your-exe-name
85To open a shell for use with `cabal` run:
89cabal new-build your-package-name
90cabal new-repl your-package-name:library:your-package-name
95CI pushes to [[https://cachix.org][cachix]] so you can benefit from the cache
96if you pin a combination of =haskell.nix= and =nixpkgs= built by CI.
98You'll need to configure the [[https://iohk.cachix.org][iohk cachix]]
99as a =substituter= for =nix= and add the public key found at the url to
100=trusted-public-keys=.
104The =haskell.nix= repository contains the runtime system for building
105Haskell packages in Nix. It depends on other repos, which are:
107- [[https://github.com/input-output-hk/nix-tools][nix-tools]] — provides the programs for generating Nix expressions from
110- [[https://github.com/input-output-hk/hackage.nix][hackage.nix]] — the latest contents of the [[https://hackage.haskell.org/][Hackage]] databases,
111 converted to Nix expressions.
113- [[https://github.com/input-output-hk/stackage.nix][stackage.nix]] — all of the [[https://www.stackage.org/][Stackage]] snapshots, converted to Nix
118Join the [[https://www.irccloud.com/invite?channel=%23haskell.nix&hostname=irc.freenode.net&port=6697&ssl=1][#haskell.nix]] channel on [[https://freenode.net/][irc.freenode.net]] to get help or discuss
119the development of =haskell.nix= and =nix-tools=.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list