on iko/ghcjs-patch-master help sign in
Add support for materializing generated nix files (#356)

This change adds a `materialized` argument to the functions that generate nix files with `plan-to-nix` and `stack-to-nix`. * Provides `builtins.trace` messages with pointers on how to do so. * Includes a `checkMaterialized` option that can be used to verify the materialized files. * Documents how to script updates with `plan-nix` or `stack-nix`. * Outputs warnings if materialized files are used without hash (or without an `index-state` for cabal projects). * Provides materialized nix files for `alex`, `happy` and `hscolour`

commitf5d1f82952393733b035f6e51ce822f9b4d36a33 authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateTue 10 Dec 2019, 16:42 (7 years ago) parent7e996d5
12 files changed+1073−19
docs/user-guide/materialization.md+270 lib/call-cabal-project-to-nix.nix+21−10 lib/call-stack-to-nix.nix+15−4 lib/materialize.nix+89 materialized/alex/.plan.nix/alex.nix+191 materialized/alex/default.nix+49 materialized/happy/.plan.nix/happy.nix+223 materialized/happy/default.nix+63 materialized/hscolour/.plan.nix/hscolour.nix+101 materialized/hscolour/default.nix+33 overlays/bootstrap.nix+6−3 overlays/haskell.nix+12−2
docs/user-guide/materialization.mdnew file+270
@@ -0,0 +1,270 @@
1+# Materialization
2+
3+## What is materialization?
4+
5+Capturing and storing the nix files for a project so that they do
6+not need to be built (or checked). This allows us to cache the input
7+of an IFD (import from derviation).
8+
9+## Why use materialization?
10+
11+Using functions like `cabalProject`, `stackProject` and `hackage-package`
12+results in a lot of dependencies (all the dependencies of nix-tools
13+for instance).
14+
15+* They can be slow to calculate (even if no work needs to be done it
16+ is not unusual for it to take 5 seconds per project).
17+
18+* They can be slow to build (or download) on machines that do not
19+ yet have them in the nix store.
20+
21+* Hydra does not show progress because it does not provide feedback
22+ until it has a list of jobs and the list of jobs cannot depends
23+ on the nix being present (although this is often blamed on IFD
24+ it would be the same if it wrote out JSON files and read them in)
25+
26+## When is it ok to materialize?
27+
28+* The nix is unlikely to change frequently (and when it does you
29+ are happy to manually update it).
30+
31+* You are happy to script something to update the materialized
32+ nix files automatically.
33+* You are certain that the IFD you materialize is not `system`-dependent. If it was you'd
34+ obtain different nix expressions depending on which `system` the IFD was evaluated.
35+
36+## How can we materialize the nix files?
37+
38+Lets say we want to build `hlint`. We might start with an `hlint`
39+file that looks like this:
40+
41+```nix
42+((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
43+ name = "hlint";
44+ version = "2.2.4";
45+}).components.exes.hlint
46+```
47+
48+Building this may result in a lot of output, but if youb build
49+it again it should give just:
50+
51+```
52+$ nix-build hlint.nix
53+trace: Using latest index state for hlint!
54+trace: Using index-state: 2019-12-09T00:00:00Z for hlint
55+/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
56+```
57+
58+To materialize the nix files we need to take care to pin down the
59+inputs. For `cabalProject` and `hackage-package` this means
60+we must specify the `index-state` of hackage we want to use:
61+
62+```nix
63+((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
64+ name = "hlint";
65+ version = "2.2.4";
66+ index-state = "2019-12-03T00:00:00Z";
67+}).components.exes.hlint
68+```
69+
70+Now if we build again we get a hint telling use how to
71+calculate a suitable sha256 hash to turn the derivation
72+containing the nix files into a fixed output derivation:
73+
74+```
75+$ nix-build hlint.nix
76+trace: Using index-state: 2019-12-03T00:00:00Z for hlint
77+trace: Get `plan-sha256` with `nix-hash --base32 --type sha256 /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs/`
78+/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
79+
80+$ nix-hash --base32 --type sha256 /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs/
81+1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss
82+```
83+
84+We can add the hash as `plan-sha256` or (`stack-sha256` for
85+`stackProject`)
86+
87+```nix
88+((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
89+ name = "hlint";
90+ version = "2.2.4";
91+ index-state = "2019-12-03T00:00:00Z";
92+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
93+}).components.exes.hlint
94+```
95+
96+Just adding the hash might help reuse of the cached nix, but nix will
97+still calculate all the dependencies (which can add seconds to
98+`nix-build` and `nix-shell` commands when no other work is needed)
99+and users who do not yet have the dependencies in their store will have
100+to wait while they are built or downloaded.
101+
102+Running nix build again gives us a hint on what we can do next:
103+
104+```
105+$ nix-build hlint.nix
106+trace: Using index-state: 2019-12-03T00:00:00Z for hlint
107+trace: To materialize, point `materialized` to a copy of /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs
108+/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
109+```
110+
111+To capture the nix we can do something like:
112+
113+```nix
114+((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
115+ name = "hlint";
116+ version = "2.2.4";
117+ index-state = "2019-12-03T00:00:00Z";
118+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
119+ materialized = ./hlint.materialized;
120+}).components.exes.hlint
121+```
122+
123+Now we can copy the nix files needed and build with:
124+
125+```
126+$ cp -r /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs hlint.materialized
127+$ nix-build hlint.nix
128+/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
129+```
130+
131+We may want to run `cmod -R +w hlint.materialized` as the files copied from the
132+store will be read only.
133+
134+## How can we check `sha256` and `materialized` are up to date?
135+
136+Let's pretend we had to go back to `hlint` version `2.2.3`.
137+We can change `version` and temporarily add
138+`checkMaterialization = true;`:
139+
140+```nix
141+((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
142+ name = "hlint";
143+ version = "2.2.3";
144+ index-state = "2019-12-03T00:00:00Z";
145+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
146+ materialized = ./hlint.materialized;
147+ checkMaterialization = true;
148+}).components.exes.hlint
149+```
150+
151+This will fail and report the details of what is wrong:
152+
153+```
154+$ nix-build hlint.nix
155+trace: Using index-state: 2019-12-03T00:00:00Z for hlint
156+building '/nix/store/zmif4gk52ynh57pf4dikzgsk30haqi2b-hlint-plan-to-nix-pkgs.drv'...
157+Changes to hlint-plan-to-nix-pkgs not reflected in plan-sha256
158+diff -ru /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs/.plan.nix/hlint.nix /nix/store/h5j8k3y5lansyfss25gd7knbninzr6z4-hlint-plan-to-nix-pkgs/.plan.nix/hlint.nix
159+--- /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs/.plan.nix/hlint.nix 1970-01-01 00:00:01.000000000 +0000
160++++ /nix/store/h5j8k3y5lansyfss25gd7knbninzr6z4-hlint-plan-to-nix-pkgs/.plan.nix/hlint.nix 1970-01-01 00:00:01.000000000 +0000
161+@@ -42,7 +42,7 @@
162+ flags = { threaded = true; gpl = true; ghc-lib = false; };
163+ package = {
164+ specVersion = "1.18";
165+- identifier = { name = "hlint"; version = "2.2.4"; };
166++ identifier = { name = "hlint"; version = "2.2.3"; };
167+ license = "BSD-3-Clause";
168+ copyright = "Neil Mitchell 2006-2019";
169+ maintainer = "Neil Mitchell <ndmitchell@gmail.com>";
170+@@ -95,7 +95,6 @@
171+ (hsPkgs."extra" or (buildDepError "extra"))
172+ (hsPkgs."refact" or (buildDepError "refact"))
173+ (hsPkgs."aeson" or (buildDepError "aeson"))
174+- (hsPkgs."filepattern" or (buildDepError "filepattern"))
175+ (hsPkgs."syb" or (buildDepError "syb"))
176+ (hsPkgs."mtl" or (buildDepError "mtl"))
177+ ] ++ (if !flags.ghc-lib && (compiler.isGhc && (compiler.version).ge "8.8.0") && (compiler.isGhc && (compiler.version).lt "8.9.0")
178+diff -ru /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs/default.nix /nix/store/h5j8k3y5lansyfss25gd7knbninzr6z4-hlint-plan-to-nix-pkgs/default.nix
179+--- /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs/default.nix 1970-01-01 00:00:01.000000000 +0000
180++++ /nix/store/h5j8k3y5lansyfss25gd7knbninzr6z4-hlint-plan-to-nix-pkgs/default.nix 1970-01-01 00:00:01.000000000 +0000
181+@@ -76,7 +76,7 @@
182+ "tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
183+ "tagged".flags.transformers = true;
184+ "tagged".flags.deepseq = true;
185+- "haskell-src-exts".revision = (((hackage."haskell-src-exts")."1.22.0").revisions).default;
186++ "haskell-src-exts".revision = (((hackage."haskell-src-exts")."1.21.1").revisions).default;
187+ "unliftio-core".revision = (((hackage."unliftio-core")."0.1.2.0").revisions).default;
188+ "ghc-lib-parser".revision = (((hackage."ghc-lib-parser")."8.8.1").revisions).default;
189+ "containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
190+@@ -116,7 +116,6 @@
191+ "hpc".revision = (((hackage."hpc")."0.6.0.3").revisions).default;
192+ "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
193+ "process".revision = (((hackage."process")."1.6.5.0").revisions).default;
194+- "filepattern".revision = (((hackage."filepattern")."0.1.1").revisions).default;
195+ "libyaml".revision = (((hackage."libyaml")."0.1.1.1").revisions).default;
196+ "libyaml".flags.system-libyaml = false;
197+ "libyaml".flags.no-unicode = false;
198+Calculated hash is 1qjmhlb4rw6mggs7y57f6zr5zjmkhkx7sn9q8pb18308n5nxgxcs expected hash was 1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss for hlint-plan-to-nix-pkgs
199+builder for '/nix/store/zmif4gk52ynh57pf4dikzgsk30haqi2b-hlint-plan-to-nix-pkgs.drv' failed with exit code 1
200+error: build of '/nix/store/zmif4gk52ynh57pf4dikzgsk30haqi2b-hlint-plan-to-nix-pkgs.drv' failed
201+```
202+
203+Checking the materialization requires nix to do all the work that materialization
204+avoids. So while it might be tempting to leave `checkMaterialization = true` all
205+the time, we would be better off just removing `materialized` and `plan-sha256`.
206+
207+## How can we update the nix files with a script?
208+
209+There are versions of the functions (`cabalProject'`, `stackProject'`
210+and `hackage-project`) that also return the nix as `plan-nix` or
211+`stack-nix`. By calling one of these functions without the
212+hash and materialized nix we can find out what nix files should be.
213+For instance:
214+
215+```nix
216+(import ./nixpkgs (import ./.)).haskell-nix.hackage-project {
217+ name = "hlint";
218+ version = "2.2.4";
219+ index-state = "2019-12-03T00:00:00Z";
220+}
221+```
222+
223+```
224+$ nix-build hlint.nix -A plan-nix
225+trace: Using index-state: 2019-12-03T00:00:00Z for hlint
226+trace: Get `plan-sha256` with `nix-hash --base32 --type sha256 /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs/`
227+/nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs
228+```
229+
230+We can have the script copy `$(nix-build hlint.nix -A plan-nix --no-out-link)`
231+and use `nix-hash` to calculate the new value for `plan-sha256`.
232+
233+## Can we skip making a copy and use `materialized = /nix/store/...`?
234+
235+Yes and it gives us the same speed improvement, however:
236+
237+* It does not help at all in `restricted-eval` mode (Hydra).
238+
239+* Users will still wind up building or downloading the dependencies
240+ needed to build the nix fileds (if they do not have them).
241+
242+For instance:
243+
244+```nix
245+((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
246+ name = "hlint";
247+ version = "2.2.4";
248+ index-state = "2019-12-03T00:00:00Z";
249+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
250+ materialized = /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs;
251+}).components.exes.hlint
252+```
253+
254+Running when no building is needed is still slow in restricted evaluation mode.
255+
256+```
257+$ time nix-build --option restrict-eval true -I . --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" hlint.nix
258+trace: Using index-state: 2019-12-03T00:00:00Z for hlint
259+/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
260+
261+real 0m10.066s
262+user 0m8.563s
263+sys 0m0.630s
264+$ time nix-build hlint.nix
265+/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
266+
267+real 0m4.628s
268+user 0m3.889s
269+sys 0m0.389s
270+```
lib/call-cabal-project-to-nix.nix+21−10
@@ -1,9 +1,11 @@
1−{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert, index-state-hashes, haskellLib }@defaults:
1+{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert, index-state-hashes, haskellLib, materialize }@defaults:
22{ name ? null # optional name for better error messages
33, src
44, index-state ? null # Hackage index-state, eg. "2019-10-10T00:00:00Z"
55, index-sha256 ? null # The hash of the truncated hackage index-state
66, plan-sha256 ? null # The hash of the plan-to-nix output (makes the plan-to-nix step a fixed output derivation)
7+, materialized ? null # Location of a materialized copy of the nix files
8+, checkMaterialization ? null # If true the nix files will be generated used to check plan-sha256 and material
79, cabalProject ? null # Cabal project file (when null uses "${src}/cabal.project")
810, ghc ? defaults.ghc
911, nix-tools ? defaults.nix-tools
@@ -156,20 +158,24 @@ let
156158 }
157159 else replaceSoureRepos rawCabalProject;
158160
159− plan-nix = runCommand (if name == null then "plan-to-nix-pkgs" else name + "-plan-to-nix-pkgs") ({
161+ plan-nix = materialize ({
162+ inherit materialized;
163+ sha256 = plan-sha256;
164+ sha256Arg = "plan-sha256";
165+ # Before pinning stuff down we need an index state to use
166+ reasonNotSafe =
167+ if index-state == null
168+ then "index-state is not set"
169+ else null;
170+ } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
171+ inherit checkMaterialization;
172+ }) (runCommand (if name == null then "plan-to-nix-pkgs" else name + "-plan-to-nix-pkgs") {
160173 nativeBuildInputs = [ nix-tools ghc hpack cabal-install pkgs.rsync pkgs.git ];
161174 # Needed or stack-to-nix will die on unicode inputs
162175 LANG = "en_US.UTF-8";
163176 meta.platforms = pkgs.lib.platforms.all;
164177 preferLocalBuild = false;
165− } // (if plan-sha256 == null
166− then {}
167− else {
168− outputHashMode = "recursive";
169− outputHashAlgo = "sha256";
170− outputHash = plan-sha256;
171− })
172− ) (''
178+ } ''
173179 tmp=$(mktemp -d)
174180 cd $tmp
175181 # if maybeCleanedSource is empty, this means it's a new
@@ -222,6 +228,11 @@ let
222228 # proper relative paths.
223229 (cd $out && plan-to-nix --full --plan-json $tmp/dist-newstyle/cache/plan.json -o .)
224230
231+ # Remove the non nix files ".project" ".cabal" "package.yaml" files
232+ # as they should not be in the output hash (they may change slightly
233+ # without affecting the nix).
234+ find $out -type f ! -name '*.nix' -exec rm "{}" \;
235+
225236 # move pkgs.nix to default.nix ensure we can just nix `import` the result.
226237 mv $out/pkgs.nix $out/default.nix
227238 '');
lib/call-stack-to-nix.nix+15−4
@@ -5,8 +5,12 @@
55 *
66 * see also `call-cabal-project-to-nix`!
77 */
8−{ runCommand, nix-tools, pkgs, mkCacheFile }:
9−{ src, stackYaml ? null, ignorePackageYaml ? false, cache ? null, ... }:
8+{ runCommand, nix-tools, pkgs, mkCacheFile, materialize }:
9+{ src, stackYaml ? null, ignorePackageYaml ? false, cache ? null
10+, stack-sha256 ? null
11+, materialized ? null # Location of a materialized copy of the nix files
12+, checkMaterialization ? null # If true the nix files will be generated used to check plan-sha256 and material
13+, ... }:
1014let
1115 stackToNixArgs = builtins.concatStringsSep " " [
1216 "--full"
@@ -14,7 +18,14 @@ let
1418 (if ignorePackageYaml then "--ignore-package-yaml" else "")
1519 "-o ."
1620 ];
17− stack = runCommand "stack-to-nix-pkgs" {
21+ stack = materialize ({
22+ inherit materialized;
23+ sha256 = stack-sha256;
24+ sha256Arg = "stack-sha256";
25+ reasonNotSafe = null;
26+ } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
27+ inherit checkMaterialization;
28+ }) (runCommand "stack-to-nix-pkgs" {
1829 nativeBuildInputs = [ nix-tools pkgs.nix-prefetch-git pkgs.cacert ];
1930 # Needed or stack-to-nix will die on unicode inputs
2031 LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.stdenv.hostPlatform.libc == "glibc") "${pkgs.glibcLocales}/lib/locale/locale-archive";
@@ -36,5 +47,5 @@ let
3647
3748 # move pkgs.nix to default.nix ensure we can just nix `import` the result.
3849 mv $out/pkgs.nix $out/default.nix
39− '');
50+ ''));
4051in { projectNix = stack; inherit src; sourceRepos = []; }
lib/materialize.nixnew file+89
@@ -0,0 +1,89 @@
1+{ pkgs, nix, runCommand, checkMaterialization }@defaults:
2+{ sha256
3+, sha256Arg
4+, materialized
5+, reasonNotSafe
6+, checkMaterialization ? defaults.checkMaterialization
7+}: derivation:
8+
9+let
10+ inherit (derivation) name;
11+
12+ traceIgnoringSha256 = reason: x:
13+ if sha256 != null
14+ then builtins.trace ("Warning: ignoring sha256 for " + name + " " + reason) x
15+ else x;
16+
17+ traceIgnoringMaterialized = reason: x:
18+ if materialized != null
19+ then builtins.trace ("Warning: ignoring materialized for " + name + " " + reason) x
20+ else x;
21+
22+ unchecked =
23+ if reasonNotSafe != null
24+ then
25+ # Warn the user if they tried to pin stuff down when it is not safe
26+ traceIgnoringSha256 reasonNotSafe
27+ (traceIgnoringMaterialized reasonNotSafe calculateNoHash)
28+ else if sha256 == null
29+ then
30+ # Let the user know how to calculate a sha256 to use to make this
31+ # a fixed output derivation.
32+ builtins.trace ("Get `${sha256Arg}` with `nix-hash --base32 --type sha256 "
33+ + toString calculateNoHash + "/`") (traceIgnoringMaterialized
34+ "${sha256Arg} is not set" calculateNoHash)
35+ else if materialized == null
36+ then
37+ # To avoid any IFD dependencies add a `materialized` copy somewhere
38+ # and pass it in.
39+ builtins.trace ("To materialize, point `materialized` to a copy of " + toString calculateUseHash)
40+ calculateUseHash
41+ else
42+ # Everything is in place we can safely use the sha256 and materialized
43+ calculateUseAll;
44+
45+ # Build fully and check the hash and materialized versions
46+ checked = runCommand name {
47+ buildInputs = [ nix ];
48+ } (
49+ (pkgs.lib.optionalString (sha256 != null) ''
50+ NEW_HASH=$(nix-hash --base32 --type sha256 ${calculateNoHash})
51+ if [ "${sha256}" != "$NEW_HASH" ]; then
52+ echo Changes to ${name} not reflected in ${sha256Arg}
53+ diff -ru ${calculateUseHash} ${calculateNoHash} || true
54+ echo Calculated hash is $NEW_HASH expected hash was ${sha256} for ${name}
55+ false
56+ else
57+ echo ${sha256Arg} used for ${name} is correct
58+ fi
59+ '')
60+ + (pkgs.lib.optionalString (materialized != null) ''
61+ if diff -qr ${materialized} ${calculateNoHash} &>/dev/null; then
62+ echo materialized nix used for ${name} is correct
63+ else
64+ echo Changes to plan not reflected in materialized nix for ${name}
65+ diff -ru ${materialized} ${calculateNoHash}
66+ fi
67+ '')
68+ + ''
69+ cp -r ${unchecked} $out
70+ ''
71+ );
72+
73+ hashArgs = {
74+ outputHashMode = "recursive";
75+ outputHashAlgo = "sha256";
76+ outputHash = sha256;
77+ };
78+ calculateNoHash = derivation;
79+ calculateUseHash = derivation.overrideAttrs (_: hashArgs);
80+ calculateUseAll =
81+ # Skip right to expectedPath if it already exists
82+ if materialized != null && builtins.pathExists materialized
83+ then runCommand name hashArgs "cp -r ${materialized} $out"
84+ else calculateUseHash;
85+
86+in
87+ if checkMaterialization
88+ then checked
89+ else unchecked
materialized/alex/.plan.nix/alex.nixnew file+191
@@ -0,0 +1,191 @@
1+let
2+ buildDepError = pkg:
3+ builtins.throw ''
4+ The Haskell package set does not contain the package: ${pkg} (build dependency).
5+
6+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
7+ '';
8+ sysDepError = pkg:
9+ builtins.throw ''
10+ The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
11+
12+ You may need to augment the system package mapping in haskell.nix so that it can be found.
13+ '';
14+ pkgConfDepError = pkg:
15+ builtins.throw ''
16+ The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
17+
18+ You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
19+ '';
20+ exeDepError = pkg:
21+ builtins.throw ''
22+ The local executable components do not include the component: ${pkg} (executable dependency).
23+ '';
24+ legacyExeDepError = pkg:
25+ builtins.throw ''
26+ The Haskell package set does not contain the package: ${pkg} (executable dependency).
27+
28+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
29+ '';
30+ buildToolDepError = pkg:
31+ builtins.throw ''
32+ Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
33+
34+ If this is a system dependency:
35+ You may need to augment the system package mapping in haskell.nix so that it can be found.
36+
37+ If this is a Haskell dependency:
38+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
39+ '';
40+in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
41+ {
42+ flags = { small_base = true; };
43+ package = {
44+ specVersion = "1.8";
45+ identifier = { name = "alex"; version = "3.2.4"; };
46+ license = "BSD-3-Clause";
47+ copyright = "(c) Chis Dornan, Simon Marlow";
48+ maintainer = "Simon Marlow <marlowsd@gmail.com>";
49+ author = "Chris Dornan and Simon Marlow";
50+ homepage = "http://www.haskell.org/alex/";
51+ url = "";
52+ synopsis = "Alex is a tool for generating lexical analysers in Haskell";
53+ description = "Alex is a tool for generating lexical analysers in Haskell.\nIt takes a description of tokens based on regular\nexpressions and generates a Haskell module containing code\nfor scanning text efficiently. It is similar to the tool\nlex or flex for C/C++.";
54+ buildType = "Simple";
55+ isLocal = true;
56+ detailLevel = "FullDetails";
57+ licenseFiles = [ "LICENSE" ];
58+ dataDir = "data/";
59+ dataFiles = [
60+ "AlexTemplate"
61+ "AlexTemplate-ghc"
62+ "AlexTemplate-ghc-nopred"
63+ "AlexTemplate-ghc-debug"
64+ "AlexTemplate-debug"
65+ "AlexWrapper-basic"
66+ "AlexWrapper-basic-bytestring"
67+ "AlexWrapper-strict-bytestring"
68+ "AlexWrapper-posn"
69+ "AlexWrapper-posn-bytestring"
70+ "AlexWrapper-monad"
71+ "AlexWrapper-monad-bytestring"
72+ "AlexWrapper-monadUserState"
73+ "AlexWrapper-monadUserState-bytestring"
74+ "AlexWrapper-gscan"
75+ ];
76+ extraSrcFiles = [
77+ "CHANGELOG.md"
78+ "README.md"
79+ "TODO"
80+ "alex.spec"
81+ "doc/Makefile"
82+ "doc/aclocal.m4"
83+ "doc/alex.1.in"
84+ "doc/alex.xml"
85+ "doc/config.mk.in"
86+ "doc/configure.ac"
87+ "doc/docbook-xml.mk"
88+ "doc/fptools.css"
89+ "examples/Makefile"
90+ "examples/Tokens.x"
91+ "examples/Tokens_gscan.x"
92+ "examples/Tokens_posn.x"
93+ "examples/examples.x"
94+ "examples/haskell.x"
95+ "examples/lit.x"
96+ "examples/pp.x"
97+ "examples/state.x"
98+ "examples/tiny.y"
99+ "examples/words.x"
100+ "examples/words_monad.x"
101+ "examples/words_posn.x"
102+ "src/Parser.y.boot"
103+ "src/Scan.x.boot"
104+ "src/ghc_hooks.c"
105+ "templates/GenericTemplate.hs"
106+ "templates/wrappers.hs"
107+ "tests/Makefile"
108+ "tests/simple.x"
109+ "tests/null.x"
110+ "tests/tokens.x"
111+ "tests/tokens_gscan.x"
112+ "tests/tokens_posn.x"
113+ "tests/tokens_bytestring.x"
114+ "tests/tokens_posn_bytestring.x"
115+ "tests/tokens_scan_user.x"
116+ "tests/tokens_strict_bytestring.x"
117+ "tests/tokens_monad_bytestring.x"
118+ "tests/tokens_monadUserState_bytestring.x"
119+ "tests/tokens_bytestring_unicode.x"
120+ "tests/basic_typeclass.x"
121+ "tests/basic_typeclass_bytestring.x"
122+ "tests/default_typeclass.x"
123+ "tests/gscan_typeclass.x"
124+ "tests/posn_typeclass.x"
125+ "tests/monad_typeclass.x"
126+ "tests/monad_typeclass_bytestring.x"
127+ "tests/monadUserState_typeclass.x"
128+ "tests/monadUserState_typeclass_bytestring.x"
129+ "tests/posn_typeclass_bytestring.x"
130+ "tests/strict_typeclass.x"
131+ "tests/unicode.x"
132+ ];
133+ extraTmpFiles = [];
134+ extraDocFiles = [];
135+ };
136+ components = {
137+ exes = {
138+ "alex" = {
139+ depends = [
140+ (hsPkgs."base" or (buildDepError "base"))
141+ ] ++ (if flags.small_base
142+ then [
143+ (hsPkgs."base" or (buildDepError "base"))
144+ (hsPkgs."array" or (buildDepError "array"))
145+ (hsPkgs."containers" or (buildDepError "containers"))
146+ (hsPkgs."directory" or (buildDepError "directory"))
147+ ]
148+ else [ (hsPkgs."base" or (buildDepError "base")) ]);
149+ buildable = true;
150+ modules = [
151+ "AbsSyn"
152+ "CharSet"
153+ "DFA"
154+ "DFAMin"
155+ "DFS"
156+ "Info"
157+ "Map"
158+ "NFA"
159+ "Output"
160+ "Paths_alex"
161+ "Parser"
162+ "ParseMonad"
163+ "Scan"
164+ "Set"
165+ "Sort"
166+ "Util"
167+ "UTF8"
168+ "Data/Ranged"
169+ "Data/Ranged/Boundaries"
170+ "Data/Ranged/RangedSet"
171+ "Data/Ranged/Ranges"
172+ ];
173+ hsSourceDirs = [ "src" ];
174+ mainPath = [ "Main.hs" ] ++ [ "" ];
175+ };
176+ };
177+ tests = {
178+ "tests" = {
179+ depends = [
180+ (hsPkgs."base" or (buildDepError "base"))
181+ (hsPkgs."process" or (buildDepError "process"))
182+ ];
183+ build-tools = [
184+ (hsPkgs.buildPackages.alex or (pkgs.buildPackages.alex or (buildToolDepError "alex")))
185+ ];
186+ buildable = true;
187+ mainPath = [ "test.hs" ];
188+ };
189+ };
190+ };
191+ } // rec { src = (pkgs.lib).mkDefault ../.; }
materialized/alex/default.nixnew file+49
@@ -0,0 +1,49 @@
1+{
2+ pkgs = hackage:
3+ {
4+ packages = {
5+ "ghc-prim".revision = (((hackage."ghc-prim")."0.5.2.0").revisions).default;
6+ "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
7+ "rts".revision = (((hackage."rts")."1.0").revisions).default;
8+ "deepseq".revision = (((hackage."deepseq")."1.4.3.0").revisions).default;
9+ "directory".revision = (((hackage."directory")."1.3.1.5").revisions).default;
10+ "containers".revision = (((hackage."containers")."0.5.11.0").revisions).default;
11+ "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
12+ "base".revision = (((hackage."base")."4.11.1.0").revisions).default;
13+ "time".revision = (((hackage."time")."1.8.0.2").revisions).default;
14+ "filepath".revision = (((hackage."filepath")."1.4.2").revisions).default;
15+ "process".revision = (((hackage."process")."1.6.3.0").revisions).default;
16+ "array".revision = (((hackage."array")."0.5.2.0").revisions).default;
17+ "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
18+ };
19+ compiler = {
20+ version = "8.4.4";
21+ nix-name = "ghc844";
22+ packages = {
23+ "ghc-prim" = "0.5.2.0";
24+ "unix" = "2.7.2.2";
25+ "rts" = "1.0";
26+ "deepseq" = "1.4.3.0";
27+ "directory" = "1.3.1.5";
28+ "containers" = "0.5.11.0";
29+ "bytestring" = "0.10.8.2";
30+ "base" = "4.11.1.0";
31+ "time" = "1.8.0.2";
32+ "filepath" = "1.4.2";
33+ "process" = "1.6.3.0";
34+ "array" = "0.5.2.0";
35+ "integer-gmp" = "1.0.2.0";
36+ };
37+ };
38+ };
39+ extras = hackage:
40+ { packages = { alex = ./.plan.nix/alex.nix; }; };
41+ modules = [
42+ ({ lib, ... }:
43+ {
44+ packages = {
45+ "alex" = { flags = { "small_base" = lib.mkOverride 900 true; }; };
46+ };
47+ })
48+ ];
49+ }
materialized/happy/.plan.nix/happy.nixnew file+223
@@ -0,0 +1,223 @@
1+let
2+ buildDepError = pkg:
3+ builtins.throw ''
4+ The Haskell package set does not contain the package: ${pkg} (build dependency).
5+
6+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
7+ '';
8+ sysDepError = pkg:
9+ builtins.throw ''
10+ The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
11+
12+ You may need to augment the system package mapping in haskell.nix so that it can be found.
13+ '';
14+ pkgConfDepError = pkg:
15+ builtins.throw ''
16+ The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
17+
18+ You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
19+ '';
20+ exeDepError = pkg:
21+ builtins.throw ''
22+ The local executable components do not include the component: ${pkg} (executable dependency).
23+ '';
24+ legacyExeDepError = pkg:
25+ builtins.throw ''
26+ The Haskell package set does not contain the package: ${pkg} (executable dependency).
27+
28+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
29+ '';
30+ buildToolDepError = pkg:
31+ builtins.throw ''
32+ Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
33+
34+ If this is a system dependency:
35+ You may need to augment the system package mapping in haskell.nix so that it can be found.
36+
37+ If this is a Haskell dependency:
38+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
39+ '';
40+in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
41+ {
42+ flags = { small_base = true; };
43+ package = {
44+ specVersion = "1.8";
45+ identifier = { name = "happy"; version = "1.19.11"; };
46+ license = "BSD-2-Clause";
47+ copyright = "(c) Andy Gill, Simon Marlow";
48+ maintainer = "Simon Marlow <marlowsd@gmail.com>";
49+ author = "Andy Gill and Simon Marlow";
50+ homepage = "https://www.haskell.org/happy/";
51+ url = "";
52+ synopsis = "Happy is a parser generator for Haskell";
53+ description = "Happy is a parser generator for Haskell. Given a grammar\nspecification in BNF, Happy generates Haskell code to parse the\ngrammar. Happy works in a similar way to the @yacc@ tool for C.";
54+ buildType = "Custom";
55+ isLocal = true;
56+ setup-depends = [
57+ (hsPkgs.buildPackages.Cabal or (pkgs.buildPackages.Cabal or (buildToolDepError "Cabal")))
58+ (hsPkgs.buildPackages.base or (pkgs.buildPackages.base or (buildToolDepError "base")))
59+ (hsPkgs.buildPackages.directory or (pkgs.buildPackages.directory or (buildToolDepError "directory")))
60+ (hsPkgs.buildPackages.filepath or (pkgs.buildPackages.filepath or (buildToolDepError "filepath")))
61+ ];
62+ detailLevel = "FullDetails";
63+ licenseFiles = [ "LICENSE" ];
64+ dataDir = "";
65+ dataFiles = [];
66+ extraSrcFiles = [
67+ "ANNOUNCE"
68+ "CHANGES"
69+ "Makefile"
70+ "README.md"
71+ "TODO"
72+ "doc/Makefile"
73+ "doc/aclocal.m4"
74+ "doc/config.mk.in"
75+ "doc/configure.ac"
76+ "doc/docbook-xml.mk"
77+ "doc/fptools.css"
78+ "doc/happy.1.in"
79+ "doc/happy.xml"
80+ "examples/glr/nlp/Main.lhs"
81+ "examples/glr/nlp/Makefile"
82+ "examples/glr/nlp/README"
83+ "examples/glr/nlp/English.y"
84+ "examples/glr/nlp/Hugs.lhs"
85+ "examples/glr/Makefile"
86+ "examples/glr/Makefile.defs"
87+ "examples/glr/expr-eval/Main.lhs"
88+ "examples/glr/expr-eval/Makefile"
89+ "examples/glr/expr-eval/Expr.y"
90+ "examples/glr/expr-eval/README"
91+ "examples/glr/expr-eval/Hugs.lhs"
92+ "examples/glr/expr-tree/Main.lhs"
93+ "examples/glr/expr-tree/Makefile"
94+ "examples/glr/expr-tree/Expr.y"
95+ "examples/glr/expr-tree/README"
96+ "examples/glr/expr-tree/Tree.lhs"
97+ "examples/glr/expr-tree/Hugs.lhs"
98+ "examples/glr/highly-ambiguous/Main.lhs"
99+ "examples/glr/highly-ambiguous/Makefile"
100+ "examples/glr/highly-ambiguous/Expr.y"
101+ "examples/glr/highly-ambiguous/README"
102+ "examples/glr/highly-ambiguous/Hugs.lhs"
103+ "examples/glr/hidden-leftrec/Main.lhs"
104+ "examples/glr/hidden-leftrec/Makefile"
105+ "examples/glr/hidden-leftrec/Expr.y"
106+ "examples/glr/hidden-leftrec/README"
107+ "examples/glr/hidden-leftrec/Hugs.lhs"
108+ "examples/glr/expr-monad/Main.lhs"
109+ "examples/glr/expr-monad/Makefile"
110+ "examples/glr/expr-monad/Expr.y"
111+ "examples/glr/expr-monad/README"
112+ "examples/glr/expr-monad/Hugs.lhs"
113+ "examples/glr/bio-eg/Main.lhs"
114+ "examples/glr/bio-eg/Makefile"
115+ "examples/glr/bio-eg/Bio.y"
116+ "examples/glr/bio-eg/README"
117+ "examples/glr/bio-eg/1-1200.dna"
118+ "examples/glr/bio-eg/1-600.dna"
119+ "examples/glr/common/DV_lhs"
120+ "examples/glr/common/DaVinciTypes.hs"
121+ "examples/glr/packing/Main.lhs"
122+ "examples/glr/packing/Makefile"
123+ "examples/glr/packing/Expr.y"
124+ "examples/glr/packing/README"
125+ "examples/glr/packing/Hugs.lhs"
126+ "examples/PgnParser.ly"
127+ "examples/MonadTest.ly"
128+ "examples/igloo/ParserM.hs"
129+ "examples/igloo/Makefile"
130+ "examples/igloo/Parser.y"
131+ "examples/igloo/Foo.hs"
132+ "examples/igloo/README"
133+ "examples/igloo/Lexer.x"
134+ "examples/README"
135+ "examples/Calc.ly"
136+ "examples/DavesExample.ly"
137+ "examples/ErrorTest.ly"
138+ "examples/ErlParser.ly"
139+ "examples/SimonsExample.ly"
140+ "examples/LexerTest.ly"
141+ "happy.spec"
142+ "src/ARRAY-NOTES"
143+ "templates/GLR_Base.hs"
144+ "templates/GenericTemplate.hs"
145+ "templates/GLR_Lib.hs"
146+ "tests/AttrGrammar001.y"
147+ "tests/AttrGrammar002.y"
148+ "tests/Makefile"
149+ "tests/Partial.ly"
150+ "tests/Test.ly"
151+ "tests/TestMulti.ly"
152+ "tests/TestPrecedence.ly"
153+ "tests/bogus-token.y"
154+ "tests/bug001.ly"
155+ "tests/bug002.y"
156+ "tests/error001.stderr"
157+ "tests/error001.stdout"
158+ "tests/error001.y"
159+ "tests/monad001.y"
160+ "tests/monad002.ly"
161+ "tests/monaderror.y"
162+ "tests/precedence001.ly"
163+ "tests/precedence002.y"
164+ "tests/test_rules.y"
165+ "tests/issue91.y"
166+ "tests/issue93.y"
167+ "tests/issue94.y"
168+ "tests/issue95.y"
169+ "tests/monaderror-explist.y"
170+ "tests/typeclass_monad001.y"
171+ "tests/typeclass_monad002.ly"
172+ "tests/typeclass_monad_lexer.y"
173+ "tests/rank2.y"
174+ ];
175+ extraTmpFiles = [];
176+ extraDocFiles = [];
177+ };
178+ components = {
179+ exes = {
180+ "happy" = {
181+ depends = [
182+ (hsPkgs."base" or (buildDepError "base"))
183+ (hsPkgs."array" or (buildDepError "array"))
184+ (hsPkgs."containers" or (buildDepError "containers"))
185+ (hsPkgs."mtl" or (buildDepError "mtl"))
186+ ];
187+ buildable = true;
188+ modules = [
189+ "Paths_happy"
190+ "AbsSyn"
191+ "First"
192+ "GenUtils"
193+ "Grammar"
194+ "Info"
195+ "LALR"
196+ "Lexer"
197+ "ParseMonad"
198+ "Parser"
199+ "ProduceCode"
200+ "ProduceGLRCode"
201+ "NameSet"
202+ "Target"
203+ "AttrGrammar"
204+ "AttrGrammarParser"
205+ "ParamRules"
206+ "PrettyGrammar"
207+ ];
208+ hsSourceDirs = [ "src" ];
209+ mainPath = [ "Main.lhs" ];
210+ };
211+ };
212+ tests = {
213+ "tests" = {
214+ depends = [
215+ (hsPkgs."base" or (buildDepError "base"))
216+ (hsPkgs."process" or (buildDepError "process"))
217+ ];
218+ buildable = true;
219+ mainPath = [ "test.hs" ];
220+ };
221+ };
222+ };
223+ } // rec { src = (pkgs.lib).mkDefault ../.; }
materialized/happy/default.nixnew file+63
@@ -0,0 +1,63 @@
1+{
2+ pkgs = hackage:
3+ {
4+ packages = {
5+ "binary".revision = (((hackage."binary")."0.8.5.1").revisions).default;
6+ "ghc-prim".revision = (((hackage."ghc-prim")."0.5.2.0").revisions).default;
7+ "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
8+ "mtl".revision = (((hackage."mtl")."2.2.2").revisions).default;
9+ "rts".revision = (((hackage."rts")."1.0").revisions).default;
10+ "deepseq".revision = (((hackage."deepseq")."1.4.3.0").revisions).default;
11+ "parsec".revision = (((hackage."parsec")."3.1.13.0").revisions).default;
12+ "directory".revision = (((hackage."directory")."1.3.1.5").revisions).default;
13+ "containers".revision = (((hackage."containers")."0.5.11.0").revisions).default;
14+ "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
15+ "text".revision = (((hackage."text")."1.2.3.1").revisions).default;
16+ "Cabal".revision = (((hackage."Cabal")."2.2.0.1").revisions).default;
17+ "base".revision = (((hackage."base")."4.11.1.0").revisions).default;
18+ "time".revision = (((hackage."time")."1.8.0.2").revisions).default;
19+ "transformers".revision = (((hackage."transformers")."0.5.5.0").revisions).default;
20+ "filepath".revision = (((hackage."filepath")."1.4.2").revisions).default;
21+ "process".revision = (((hackage."process")."1.6.3.0").revisions).default;
22+ "pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
23+ "array".revision = (((hackage."array")."0.5.2.0").revisions).default;
24+ "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
25+ };
26+ compiler = {
27+ version = "8.4.4";
28+ nix-name = "ghc844";
29+ packages = {
30+ "binary" = "0.8.5.1";
31+ "ghc-prim" = "0.5.2.0";
32+ "unix" = "2.7.2.2";
33+ "mtl" = "2.2.2";
34+ "rts" = "1.0";
35+ "deepseq" = "1.4.3.0";
36+ "parsec" = "3.1.13.0";
37+ "directory" = "1.3.1.5";
38+ "containers" = "0.5.11.0";
39+ "bytestring" = "0.10.8.2";
40+ "text" = "1.2.3.1";
41+ "Cabal" = "2.2.0.1";
42+ "base" = "4.11.1.0";
43+ "time" = "1.8.0.2";
44+ "transformers" = "0.5.5.0";
45+ "filepath" = "1.4.2";
46+ "process" = "1.6.3.0";
47+ "pretty" = "1.1.3.6";
48+ "array" = "0.5.2.0";
49+ "integer-gmp" = "1.0.2.0";
50+ };
51+ };
52+ };
53+ extras = hackage:
54+ { packages = { happy = ./.plan.nix/happy.nix; }; };
55+ modules = [
56+ ({ lib, ... }:
57+ {
58+ packages = {
59+ "happy" = { flags = { "small_base" = lib.mkOverride 900 true; }; };
60+ };
61+ })
62+ ];
63+ }
materialized/hscolour/.plan.nix/hscolour.nixnew file+101
@@ -0,0 +1,101 @@
1+let
2+ buildDepError = pkg:
3+ builtins.throw ''
4+ The Haskell package set does not contain the package: ${pkg} (build dependency).
5+
6+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
7+ '';
8+ sysDepError = pkg:
9+ builtins.throw ''
10+ The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
11+
12+ You may need to augment the system package mapping in haskell.nix so that it can be found.
13+ '';
14+ pkgConfDepError = pkg:
15+ builtins.throw ''
16+ The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
17+
18+ You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
19+ '';
20+ exeDepError = pkg:
21+ builtins.throw ''
22+ The local executable components do not include the component: ${pkg} (executable dependency).
23+ '';
24+ legacyExeDepError = pkg:
25+ builtins.throw ''
26+ The Haskell package set does not contain the package: ${pkg} (executable dependency).
27+
28+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
29+ '';
30+ buildToolDepError = pkg:
31+ builtins.throw ''
32+ Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
33+
34+ If this is a system dependency:
35+ You may need to augment the system package mapping in haskell.nix so that it can be found.
36+
37+ If this is a Haskell dependency:
38+ If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
39+ '';
40+in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
41+ {
42+ flags = {};
43+ package = {
44+ specVersion = "1.6";
45+ identifier = { name = "hscolour"; version = "1.24.4"; };
46+ license = "LicenseRef-LGPL";
47+ copyright = "2003-2017 Malcolm Wallace; 2006 Bjorn Bringert";
48+ maintainer = "Malcolm Wallace";
49+ author = "Malcolm Wallace";
50+ homepage = "http://code.haskell.org/~malcolm/hscolour/";
51+ url = "";
52+ synopsis = "Colourise Haskell code.";
53+ description = "hscolour is a small Haskell script to colourise Haskell code. It currently\nhas six output formats:\nANSI terminal codes (optionally XTerm-256colour codes),\nHTML 3.2 with <font> tags,\nHTML 4.01 with CSS,\nHTML 4.01 with CSS and mouseover annotations,\nXHTML 1.0 with inline CSS styling,\nLaTeX,\nand mIRC chat codes.";
54+ buildType = "Simple";
55+ isLocal = true;
56+ detailLevel = "FullDetails";
57+ licenseFiles = [ "LICENCE-LGPL" ];
58+ dataDir = "";
59+ dataFiles = [ "hscolour.css" "data/rgb24-example-.hscolour" ];
60+ extraSrcFiles = [];
61+ extraTmpFiles = [];
62+ extraDocFiles = [];
63+ };
64+ components = {
65+ "library" = {
66+ depends = [
67+ (hsPkgs."base" or (buildDepError "base"))
68+ (hsPkgs."containers" or (buildDepError "containers"))
69+ ];
70+ buildable = true;
71+ modules = [
72+ "Language/Haskell/HsColour"
73+ "Language/Haskell/HsColour/ANSI"
74+ "Language/Haskell/HsColour/Anchors"
75+ "Language/Haskell/HsColour/ACSS"
76+ "Language/Haskell/HsColour/CSS"
77+ "Language/Haskell/HsColour/Classify"
78+ "Language/Haskell/HsColour/ColourHighlight"
79+ "Language/Haskell/HsColour/Colourise"
80+ "Language/Haskell/HsColour/General"
81+ "Language/Haskell/HsColour/HTML"
82+ "Language/Haskell/HsColour/InlineCSS"
83+ "Language/Haskell/HsColour/LaTeX"
84+ "Language/Haskell/HsColour/MIRC"
85+ "Language/Haskell/HsColour/Options"
86+ "Language/Haskell/HsColour/Output"
87+ "Language/Haskell/HsColour/TTY"
88+ ];
89+ };
90+ exes = {
91+ "HsColour" = {
92+ depends = [
93+ (hsPkgs."base" or (buildDepError "base"))
94+ (hsPkgs."containers" or (buildDepError "containers"))
95+ ];
96+ buildable = true;
97+ mainPath = [ "HsColour.hs" ];
98+ };
99+ };
100+ };
101+ } // rec { src = (pkgs.lib).mkDefault ../.; }
materialized/hscolour/default.nixnew file+33
@@ -0,0 +1,33 @@
1+{
2+ pkgs = hackage:
3+ {
4+ packages = {
5+ "ghc-prim".revision = (((hackage."ghc-prim")."0.5.2.0").revisions).default;
6+ "rts".revision = (((hackage."rts")."1.0").revisions).default;
7+ "deepseq".revision = (((hackage."deepseq")."1.4.3.0").revisions).default;
8+ "containers".revision = (((hackage."containers")."0.5.11.0").revisions).default;
9+ "base".revision = (((hackage."base")."4.11.1.0").revisions).default;
10+ "array".revision = (((hackage."array")."0.5.2.0").revisions).default;
11+ "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
12+ };
13+ compiler = {
14+ version = "8.4.4";
15+ nix-name = "ghc844";
16+ packages = {
17+ "ghc-prim" = "0.5.2.0";
18+ "rts" = "1.0";
19+ "deepseq" = "1.4.3.0";
20+ "containers" = "0.5.11.0";
21+ "base" = "4.11.1.0";
22+ "array" = "0.5.2.0";
23+ "integer-gmp" = "1.0.2.0";
24+ };
25+ };
26+ };
27+ extras = hackage:
28+ { packages = { hscolour = ./.plan.nix/hscolour.nix; }; };
29+ modules = [
30+ ({ lib, ... }:
31+ { packages = { "hscolour" = { flags = {}; }; }; })
32+ ];
33+ }
overlays/bootstrap.nix+6−3
@@ -265,7 +265,8 @@ self: super: {
265265 inherit (bootstrap.packages) cabal-install nix-tools hpack;
266266 name = "alex"; version = "3.2.4";
267267 index-state = "2019-10-20T00:00:00Z";
268− plan-sha256 = "086kd6aa5bir3y4aqb1wl5zkj6agz5q4wp4snvdnf6cidz5wra06";
268+ plan-sha256 = "1adn8s46msqm2rl6yf01z2r81maa2001qh441j491gpmc3ki36n0";
269+ materialized = ../materialized/alex;
269270 };
270271 alex = bootstrap.packages.alex-project.hsPkgs.alex.components.exes.alex;
271272 happy-project = hackage-project {
@@ -274,7 +275,8 @@ self: super: {
274275 inherit (bootstrap.packages) cabal-install nix-tools hpack;
275276 name = "happy"; version = "1.19.11";
276277 index-state = "2019-10-20T00:00:00Z";
277− plan-sha256 = "011bxlxdv239psgi80j00km2wcgb68j16sz3fng67d03sqf5i37w";
278+ plan-sha256 = "0swpwhlym4p3209qv90mfgq6zsaw99ipznm4pvd32mxzwq9s5q8i";
279+ materialized = ../materialized/happy;
278280 };
279281 happy = bootstrap.packages.happy-project.hsPkgs.happy.components.exes.happy;
280282 hscolour-project = hackage-project {
@@ -283,7 +285,8 @@ self: super: {
283285 inherit (bootstrap.packages) cabal-install nix-tools hpack;
284286 name = "hscolour"; version = "1.24.4";
285287 index-state = "2019-10-20T00:00:00Z";
286− plan-sha256 = "021rwcmkshibc3mfr833ay5hfr19kq6k32lxyrrb6vp9vmihgw4b";
288+ plan-sha256 = "0cnkczsh1xy7cc60q3blwa51qrjhf5mc89s34y9ab3x702a26b75";
289+ materialized = ../materialized/hscolour;
287290 };
288291 hscolour = bootstrap.packages.hscolour-project.hsPkgs.hscolour.components.exes.HsColour;
289292 };
overlays/haskell.nix+12−2
@@ -193,6 +193,16 @@ self: super: {
193193 HOME=$out cabal new-update cached
194194 '';
195195
196+ checkMaterialization = false; # This is the default. Use an overlay to set it to true and test all the materialized files
197+
198+ # Helps materialize the output of derivations
199+ materialize = import ../lib/materialize.nix {
200+ inherit (self) nix;
201+ inherit (self.haskell-nix) checkMaterialization;
202+ pkgs = self.buildPackages.pkgs;
203+ inherit (self.buildPackages.pkgs) runCommand;
204+ };
205+
196206 update-index-state-hashes = import ../scripts/update-index-state-hashes.nix {
197207 inherit (self.haskell-nix) indexStateHashesPath nix-tools;
198208 inherit (self) coreutils nix writeShellScriptBin stdenv;
@@ -202,7 +212,7 @@ self: super: {
202212 callStackToNix = import ../lib/call-stack-to-nix.nix {
203213 pkgs = self.buildPackages.pkgs;
204214 inherit (self.buildPackages.pkgs) runCommand;
205− inherit (self.buildPackages.haskell-nix) nix-tools mkCacheFile;
215+ inherit (self.buildPackages.haskell-nix) nix-tools mkCacheFile materialize;
206216 };
207217
208218 # given a source location call `cabal-to-nix` (from nix-tools) on it
@@ -330,7 +340,7 @@ self: super: {
330340 # Resulting nix files are added to nix-plan subdirectory.
331341 callCabalProjectToNix = import ../lib/call-cabal-project-to-nix.nix {
332342 index-state-hashes = import indexStateHashesPath;
333− inherit (self.buildPackages.haskell-nix) dotCabal nix-tools haskellLib;
343+ inherit (self.buildPackages.haskell-nix) dotCabal nix-tools haskellLib materialize;
334344 pkgs = self.buildPackages.pkgs;
335345 inherit (self.buildPackages.haskell-nix.haskellPackages.hpack.components.exes) hpack;
336346 inherit (self.buildPackages.haskell-nix) cabal-install ghc;