@@ -1,117 +0,0 @@
1−#+STARTUP: showall hidestars
2−
3−* Alternative Haskell Infrastructure for Nixpkgs
4−
5−[[https://buildkite.com/input-output-hk/haskell-dot-nix][https://badge.buildkite.com/d453edcd29bd2f8f3f3b32c9b7d6777a33773d9671c37a6ccc.svg?branch=master]]
6−[[https://buildkite.com/input-output-hk/haskell-dot-nix-nightly-updates][https://img.shields.io/buildkite/c8d5a20d3ff0f440f82adb9190b43c16c91e5e47e8adfa867a/master.svg?label=nightly%20updates]]
7−
8−=haskell.nix= is an experimental new builder for Haskell packages.
9−
10−It works by automatically translating your Cabal or Stack project and
11−its dependencies into Nix code. It provides IFD (import from derivation)
12−functions that can minimize the amount of Nix code you need to add.
13−
14−For the documentation, see https://input-output-hk.github.io/haskell.nix/.
15−
16−** Quickstart
17−
18−For =cabal.project= project add a =default.nix=:
19−
20−#+begin_src sh
21−let
22− # Fetch the latest haskell.nix and import its default.nix
23− haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
24− # haskell.nix provides access to the nixpkgs pins which are used by our CI, hence
25− # you will be more likely to get cache hits when using these.
26− # But you can also just use your own, e.g. '<nixpkgs>'
27− nixpkgsSrc = haskellNix.sources.nixpkgs-1909;
28− # haskell.nix provides some arguments to be passed to nixpkgs, including some patches
29− # and also the haskell.nix functionality itself as an overlay.
30− nixpkgsArgs = haskellNix.nixpkgsArgs;
31−in
32−{ pkgs ? import nixpkgsSrc nixpkgsArgs
33−, haskellCompiler ? "ghc865"
34−}:
35−# 'cabalProject' generates a package set based on a cabal.project (and the corresponding .cabal files)
36−pkgs.haskell-nix.cabalProject {
37− # 'cleanGit' cleans a source directory based on the files known by git
38− src = pkgs.haskell-nix.haskellLib.cleanGit { name = "haskell-nix-project"; src = ./.; };
39− compiler-nix-name = haskellCompiler;
40−}
41−#+end_src
42−
43−Note that you'll need to add a comment specifying the expected sha256
44−output for your =source-repository-packages= in your =cabal.project=
45−file:
46−
47−#+begin_src sh
48−source-repository-package
49− type: git
50− location: https://github.com/input-output-hk/iohk-monitoring-framework
51− subdir: plugins/backend-editor
52− tag: 4956b32f039579a0e7e4fd10793f65b4c77d9044
53− --sha256: 03lyb2m4i6p7rpjqarnhsx21nx48fwk6rzsrx15k6274a4bv0pix
54−#+end_src
55−
56−For a =stack.yaml= project add a =default.nix=:
57−
58−#+begin_src sh
59−let
60− haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
61− nixpkgsSrc = haskellNix.sources.nixpkgs-1909;
62− nixpkgsArgs = haskellNix.nixpkgsArgs;
63−in
64−{ pkgs ? import nixpkgsSrc nixpkgsArgs
65−}:
66−pkgs.haskell-nix.stackProject {
67− src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
68−}
69−#+end_src
70−
71−To build the library component of a package in the project run:
72−
73−#+begin_src sh
74−nix build -f . your-package-name.components.library
75−#+end_src
76−
77−To build an executable:
78−
79−#+begin_src sh
80−nix build -f . your-package-name.components.exes.your-exe-name
81−#+end_src
82−
83−To open a shell for use with `cabal` run:
84−
85−#+begin_src sh
86−nix-shell -A shellFor
87−cabal new-build your-package-name
88−cabal new-repl your-package-name:library:your-package-name
89−#+end_src
90−
91−** Cache
92−
93−CI pushes to [[https://cachix.org][cachix]] so you can benefit from the cache
94−if you pin a combination of =haskell.nix= and =nixpkgs= built by CI.
95−
96−You'll need to configure the [[https://iohk.cachix.org][iohk cachix]]
97−as a =substituter= for =nix= and add the public key found at the url to
98−=trusted-public-keys=.
99−
100−** Related repos
101−
102−The =haskell.nix= repository contains the runtime system for building
103−Haskell packages in Nix. It depends on other repos, which are:
104−
105−- [[https://github.com/input-output-hk/nix-tools][nix-tools]] — provides the programs for generating Nix expressions from
106− Haskell projects.
107−
108−- [[https://github.com/input-output-hk/hackage.nix][hackage.nix]] — the latest contents of the [[https://hackage.haskell.org/][Hackage]] databases,
109− converted to Nix expressions.
110−
111−- [[https://github.com/input-output-hk/stackage.nix][stackage.nix]] — all of the [[https://www.stackage.org/][Stackage]] snapshots, converted to Nix
112− expressions.
113−
114−** IRC Channel
115−
116−Join 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
117−the development of =haskell.nix= and =nix-tools=.