Skip to content

Commit d1102d3

Browse files
authored
Add pins and materialization for ghc-boot-packages and ghc-extra-packages (#546)
* Include `tests` in path for cross compiled tests * Add ghc-boot-packages-nix to haskellNixRoots * Fix naming warnings in tests sources * Uses a single cleanGit call for all the tests * Add memoize code for ghc-boot and ghc-extra pkgs * Memoize ghc-boot and ghc-extra pkgs nix * Fix release.nix being more strict than ci.nix by updating filterAttrsOnlyRecursive in ci-lib.nix * Nicer errors when materialized path does not exist * Updated materialization docs * Add internalHackageIndexState to set the index-state used within haskell.nix
1 parent 277c9b4 commit d1102d3

File tree

140 files changed

+14927
-245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+14927
-245
lines changed

ci-lib.nix

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ in rec {
3030
# TODO: Surely this shouldn't be necessary. I think normal 'filterAttrsRecursive' will effectively cause infinite loops
3131
# if you keep derivations and your predicate forces the value of the attribute, as this then triggers a loop on the
3232
# 'out' attribute. Weird.
33+
# To make this function faster, unwanted attributes are mapped to {} instead of being
34+
# removed. This keeps the function lazy and avoids unwanted evaluation of sibling
35+
# derivations.
3336
filterAttrsOnlyRecursive = pred: set:
34-
lib.listToAttrs (
35-
lib.concatMap (name:
36-
let v = set.${name}; in
37-
if pred name v then [
38-
(lib.nameValuePair name (
39-
if builtins.isAttrs v && !lib.isDerivation v then filterAttrsOnlyRecursive pred v
37+
lib.mapAttrs (name: v:
38+
if pred name v
39+
then
40+
if builtins.isAttrs v
41+
&& !lib.isDerivation v
42+
then filterAttrsOnlyRecursive pred v
4043
else v
41-
))
42-
] else []
43-
) (builtins.attrNames set)
44-
);
44+
else {}) set;
4545
}

ci.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
5959
}
6060
//
6161
# Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
62-
pkgs.lib.optionalAttrs (crossSystemName != "aarch64-multiplatform") build.tests
62+
pkgs.lib.optionalAttrs (crossSystemName != "aarch64-multiplatform") { inherit (build) tests; }
6363
)
6464
)
6565
)

docs/user-guide/materialization.md

Lines changed: 91 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ Lets say we want to build `hlint`. We might start with an `hlint`
3939
file that looks like this:
4040

4141
```nix
42-
let inherit (import ./. {}) sources nixpkgsArgs;
42+
let inherit (import ./. {}) sources nixpkgsArgs;
4343
pkgs = import sources.nixpkgs-default nixpkgsArgs;
4444
hlint = pkgs.haskell-nix.hackage-package {
4545
name = "hlint";
46-
version = "2.2.4";
46+
version = "2.2.11";
4747
};
4848
in hlint.components.exes.hlint
4949
```
@@ -52,23 +52,23 @@ Building this may result in a lot of output, but if you build
5252
it again it should give just:
5353

5454
```
55-
$ nix-build hlint.nix
55+
$ nix-build hlint.nix
5656
trace: Using latest index state for hlint!
57-
trace: Using index-state: 2019-12-09T00:00:00Z for hlint
58-
/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
57+
trace: Using index-state: 2020-04-15T00:00:00Z for hlint
58+
/nix/store/rnfz66v7k8i38c8rsmchzsyqjrmrbdpk-hlint-2.2.11-exe-hlint
5959
```
6060

6161
To materialize the nix files we need to take care to pin down the
6262
inputs. For `cabalProject` and `hackage-package` this means
6363
we must specify the `index-state` of hackage we want to use:
6464

6565
```nix
66-
let inherit (import ./. {}) sources nixpkgsArgs;
67-
pkgs = import sources.nixpkgs-default nixpkgsArgs;
66+
let inherit (import ./. {}) sources nixpkgsArgs;
67+
pkgs = import sources.nixpkgs-default nixpkgsArgs;
6868
hlint = pkgs.haskell-nix.hackage-package {
6969
name = "hlint";
70-
version = "2.2.4";
71-
index-state = "2019-12-03T00:00:00Z";
70+
version = "2.2.11";
71+
index-state = "2020-04-15T00:00:00Z";
7272
};
7373
in hlint.components.exes.hlint
7474
```
@@ -78,26 +78,26 @@ calculate a suitable sha256 hash to turn the derivation
7878
containing the nix files into a fixed output derivation:
7979

8080
```
81-
$ nix-build hlint.nix
82-
trace: Using index-state: 2019-12-03T00:00:00Z for hlint
83-
trace: Get `plan-sha256` with `nix-hash --base32 --type sha256 /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs/`
84-
/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
81+
$ nix-build hlint.nix
82+
trace: Using index-state: 2020-04-15T00:00:00Z for hlint
83+
trace: Get `plan-sha256` with `nix-hash --base32 --type sha256 /nix/store/8z6p4237rin3c6c1lmjwshmj8rdqrhw2-hlint-plan-to-nix-pkgs/`
84+
/nix/store/rnfz66v7k8i38c8rsmchzsyqjrmrbdpk-hlint-2.2.11-exe-hlint
8585
86-
$ nix-hash --base32 --type sha256 /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs/
87-
1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss
86+
$ nix-hash --base32 --type sha256 /nix/store/8z6p4237rin3c6c1lmjwshmj8rdqrhw2-hlint-plan-to-nix-pkgs/
87+
02hasr27a994sml1fzf8swb716lm6lgixxr53y0gxkhw437xkck4
8888
```
8989

9090
We can add the hash as `plan-sha256` or (`stack-sha256` for
9191
`stackProject`)
9292

9393
```nix
94-
let inherit (import ./. {}) sources nixpkgsArgs;
95-
pkgs = import sources.nixpkgs-default nixpkgsArgs;
94+
let inherit (import ./. {}) sources nixpkgsArgs;
95+
pkgs = import sources.nixpkgs-default nixpkgsArgs;
9696
hlint = pkgs.haskell-nix.hackage-package {
9797
name = "hlint";
98-
version = "2.2.4";
99-
index-state = "2019-12-03T00:00:00Z";
100-
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
98+
version = "2.2.11";
99+
index-state = "2020-04-15T00:00:00Z";
100+
plan-sha256 = "02hasr27a994sml1fzf8swb716lm6lgixxr53y0gxkhw437xkck4";
101101
};
102102
in hlint.components.exes.hlint
103103
```
@@ -111,22 +111,22 @@ to wait while they are built or downloaded.
111111
Running nix build again gives us a hint on what we can do next:
112112

113113
```
114-
$ nix-build hlint.nix
115-
trace: Using index-state: 2019-12-03T00:00:00Z for hlint
116-
trace: To materialize, point `materialized` to a copy of /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs
117-
/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
114+
$ nix-build hlint.nix
115+
trace: Using index-state: 2020-04-15T00:00:00Z for hlint
116+
trace: To materialize, point `materialized` to a copy of /nix/store/kk047cqsjvbj4w8psv4l05abdcnyrqdc-hlint-plan-to-nix-pkgs
117+
/nix/store/rnfz66v7k8i38c8rsmchzsyqjrmrbdpk-hlint-2.2.11-exe-hlint
118118
```
119119

120120
To capture the nix we can do something like:
121121

122122
```nix
123-
let inherit (import ./. {}) sources nixpkgsArgs;
124-
pkgs = import sources.nixpkgs-default nixpkgsArgs;
123+
let inherit (import ./. {}) sources nixpkgsArgs;
124+
pkgs = import sources.nixpkgs-default nixpkgsArgs;
125125
hlint = pkgs.haskell-nix.hackage-package {
126126
name = "hlint";
127-
version = "2.2.4";
128-
index-state = "2019-12-03T00:00:00Z";
129-
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
127+
version = "2.2.11";
128+
index-state = "2020-04-15T00:00:00Z";
129+
plan-sha256 = "02hasr27a994sml1fzf8swb716lm6lgixxr53y0gxkhw437xkck4";
130130
materialized = ./hlint.materialized;
131131
};
132132
in hlint.components.exes.hlint
@@ -135,84 +135,54 @@ in hlint.components.exes.hlint
135135
Now we can copy the nix files needed and build with:
136136

137137
```
138-
$ cp -r /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs hlint.materialized
139-
$ nix-build hlint.nix
140-
/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
138+
$ cp -r /nix/store/8z6p4237rin3c6c1lmjwshmj8rdqrhw2-hlint-plan-to-nix-pkgs hlint.materialized
139+
$ nix-build hlint.nix
140+
/nix/store/rnfz66v7k8i38c8rsmchzsyqjrmrbdpk-hlint-2.2.11-exe-hlint
141141
```
142142

143143
We may want to run `chmod -R +w hlint.materialized` as the files copied from the
144144
store will be read only.
145145

146146
## How can we check `sha256` and `materialized` are up to date?
147147

148-
Let's pretend we had to go back to `hlint` version `2.2.3`.
149-
We can change `version` and temporarily add
150-
`checkMaterialization = true;`:
148+
Let's pretend we had to go back to `hlint` version `2.2.10`.
149+
We can tell haskell.nix to check the materialiazation either by:
150+
151+
* Removing the materialization files with `rm -rf hlint.materialized`
152+
* Temporarily adding `checkMaterialization = true;`
153+
154+
If we choose to add the `checkMaterialization` flag you would have:
151155

152156
```nix
153-
let inherit (import ./. {}) sources nixpkgsArgs;
154-
pkgs = import sources.nixpkgs-default nixpkgsArgs;
157+
let inherit (import ./. {}) sources nixpkgsArgs;
158+
pkgs = import sources.nixpkgs-default nixpkgsArgs;
155159
hlint = pkgs.haskell-nix.hackage-package {
156160
name = "hlint";
157-
version = "2.2.4";
158-
index-state = "2019-12-03T00:00:00Z";
159-
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
161+
version = "2.2.10";
162+
index-state = "2020-04-15T00:00:00Z";
163+
plan-sha256 = "02hasr27a994sml1fzf8swb716lm6lgixxr53y0gxkhw437xkck4";
160164
materialized = ./hlint.materialized;
161165
checkMaterialization = true;
162166
};
163167
in hlint.components.exes.hlint
164168
```
165169

166-
This will fail and report the details of what is wrong:
170+
This will fail and report the details of what is wrong and how to fix it:
167171

168172
```
169-
$ nix-build hlint.nix
170-
trace: Using index-state: 2019-12-03T00:00:00Z for hlint
171-
building '/nix/store/zmif4gk52ynh57pf4dikzgsk30haqi2b-hlint-plan-to-nix-pkgs.drv'...
172-
Changes to hlint-plan-to-nix-pkgs not reflected in plan-sha256
173-
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
174-
--- /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs/.plan.nix/hlint.nix 1970-01-01 00:00:01.000000000 +0000
175-
+++ /nix/store/h5j8k3y5lansyfss25gd7knbninzr6z4-hlint-plan-to-nix-pkgs/.plan.nix/hlint.nix 1970-01-01 00:00:01.000000000 +0000
176-
@@ -42,7 +42,7 @@
177-
flags = { threaded = true; gpl = true; ghc-lib = false; };
178-
package = {
179-
specVersion = "1.18";
180-
- identifier = { name = "hlint"; version = "2.2.4"; };
181-
+ identifier = { name = "hlint"; version = "2.2.3"; };
182-
license = "BSD-3-Clause";
183-
copyright = "Neil Mitchell 2006-2019";
184-
maintainer = "Neil Mitchell <ndmitchell@gmail.com>";
185-
@@ -95,7 +95,6 @@
186-
(hsPkgs."extra" or (buildDepError "extra"))
187-
(hsPkgs."refact" or (buildDepError "refact"))
188-
(hsPkgs."aeson" or (buildDepError "aeson"))
189-
- (hsPkgs."filepattern" or (buildDepError "filepattern"))
190-
(hsPkgs."syb" or (buildDepError "syb"))
191-
(hsPkgs."mtl" or (buildDepError "mtl"))
192-
] ++ (if !flags.ghc-lib && (compiler.isGhc && (compiler.version).ge "8.8.0") && (compiler.isGhc && (compiler.version).lt "8.9.0")
193-
diff -ru /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs/default.nix /nix/store/h5j8k3y5lansyfss25gd7knbninzr6z4-hlint-plan-to-nix-pkgs/default.nix
194-
--- /nix/store/0xalcphb7ifvy5fc9dpwj40fij6nn5av-hlint-plan-to-nix-pkgs/default.nix 1970-01-01 00:00:01.000000000 +0000
195-
+++ /nix/store/h5j8k3y5lansyfss25gd7knbninzr6z4-hlint-plan-to-nix-pkgs/default.nix 1970-01-01 00:00:01.000000000 +0000
196-
@@ -76,7 +76,7 @@
197-
"tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
198-
"tagged".flags.transformers = true;
199-
"tagged".flags.deepseq = true;
200-
- "haskell-src-exts".revision = (((hackage."haskell-src-exts")."1.22.0").revisions).default;
201-
+ "haskell-src-exts".revision = (((hackage."haskell-src-exts")."1.21.1").revisions).default;
202-
"unliftio-core".revision = (((hackage."unliftio-core")."0.1.2.0").revisions).default;
203-
"ghc-lib-parser".revision = (((hackage."ghc-lib-parser")."8.8.1").revisions).default;
204-
"containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
205-
@@ -116,7 +116,6 @@
206-
"hpc".revision = (((hackage."hpc")."0.6.0.3").revisions).default;
207-
"filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
208-
"process".revision = (((hackage."process")."1.6.5.0").revisions).default;
209-
- "filepattern".revision = (((hackage."filepattern")."0.1.1").revisions).default;
210-
"libyaml".revision = (((hackage."libyaml")."0.1.1.1").revisions).default;
211-
"libyaml".flags.system-libyaml = false;
212-
"libyaml".flags.no-unicode = false;
213-
Calculated hash is 1qjmhlb4rw6mggs7y57f6zr5zjmkhkx7sn9q8pb18308n5nxgxcs expected hash was 1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss for hlint-plan-to-nix-pkgs
214-
builder for '/nix/store/zmif4gk52ynh57pf4dikzgsk30haqi2b-hlint-plan-to-nix-pkgs.drv' failed with exit code 1
215-
error: build of '/nix/store/zmif4gk52ynh57pf4dikzgsk30haqi2b-hlint-plan-to-nix-pkgs.drv' failed
173+
$ nix-build hlint.nix
174+
175+
...
176+
177+
Calculated hash for hlint-plan-to-nix-pkgs was not 02hasr27a994sml1fzf8swb716lm6lgixxr53y0gxkhw437xkck4. New hash is :
178+
plan-sha256 = "0zsi3wv92qax33ic4n5dfsqd1r9qam1k75za3c5jqgdxl3hy8vph";
179+
Materialized nix used for hlint-plan-to-nix-pkgs incorrect. To fix run :
180+
rm -rf /Users/hamish/iohk/haskell.nix/hlint.materialized
181+
cp -r /nix/store/ywdhbx9rzzkfc60c5vzk7cins2hnvkgx-hlint-plan-to-nix-pkgs /Users/hamish/iohk/haskell.nix/hlint.materialized
182+
chmod -R +w /Users/hamish/iohk/haskell.nix/hlint.materialized
183+
builder for '/nix/store/a5zmgfjfxahapw0q8hd2da5bg7knqvbx-hlint-plan-to-nix-pkgs.drv' failed with exit code 1
184+
error: build of '/nix/store/a5zmgfjfxahapw0q8hd2da5bg7knqvbx-hlint-plan-to-nix-pkgs.drv' failed
185+
(use '--show-trace' to show detailed location information)
216186
```
217187

218188
Checking the materialization requires nix to do all the work that materialization
@@ -228,21 +198,21 @@ hash and materialized nix we can find out what nix files should be.
228198
For instance:
229199

230200
```nix
231-
let inherit (import ./. {}) sources nixpkgsArgs;
232-
pkgs = import sources.nixpkgs-default nixpkgsArgs;
201+
let inherit (import ./. {}) sources nixpkgsArgs;
202+
pkgs = import sources.nixpkgs-default nixpkgsArgs;
233203
hlint = pkgs.haskell-nix.hackage-project {
234204
name = "hlint";
235-
version = "2.2.4";
236-
index-state = "2019-12-03T00:00:00Z";
205+
version = "2.2.10";
206+
index-state = "2020-04-15T00:00:00Z";
237207
};
238208
in hlint
239209
```
240210

241211
```
242212
$ nix-build hlint.nix -A plan-nix
243-
trace: Using index-state: 2019-12-03T00:00:00Z for hlint
244-
trace: Get `plan-sha256` with `nix-hash --base32 --type sha256 /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs/`
245-
/nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs
213+
trace: Using index-state: 2020-04-15T00:00:00Z for hlint
214+
trace: Get `plan-sha256` with `nix-hash --base32 --type sha256 /nix/store/ywdhbx9rzzkfc60c5vzk7cins2hnvkgx-hlint-plan-to-nix-pkgs/`
215+
/nix/store/ywdhbx9rzzkfc60c5vzk7cins2hnvkgx-hlint-plan-to-nix-pkgs
246216
```
247217

248218
We can have the script copy `$(nix-build hlint.nix -A plan-nix --no-out-link)`
@@ -257,35 +227,41 @@ Yes and it gives us the same speed improvement, however:
257227
* Users will still wind up building or downloading the dependencies
258228
needed to build the nix fileds (if they do not have them).
259229

260-
For instance:
230+
For those reasons it might be best to make a copy instead
231+
of using the `/nix/store/...` path directly.
232+
233+
If you really want to use the `/nix/store/...` path directly
234+
you should gaurd against the path not existing as passing in
235+
a non-existing path is now an error:
261236

262237
```nix
263-
let inherit (import ./. {}) sources nixpkgsArgs;
264-
pkgs = import sources.nixpkgs-default nixpkgsArgs;
238+
let inherit (import ./. {}) sources nixpkgsArgs;
239+
pkgs = import sources.nixpkgs-default nixpkgsArgs;
240+
hlintPlan = /nix/store/kk047cqsjvbj4w8psv4l05abdcnyrqdc-hlint-plan-to-nix-pkgs;
265241
hlint = pkgs.haskell-nix.hackage-package {
266242
name = "hlint";
267-
version = "2.2.4";
268-
index-state = "2019-12-03T00:00:00Z";
269-
plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
270-
materialized = /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs;
243+
version = "2.2.11";
244+
index-state = "2020-04-15T00:00:00Z";
245+
plan-sha256 = "02hasr27a994sml1fzf8swb716lm6lgixxr53y0gxkhw437xkck4";
246+
materialized = if __pathExists hlintPlan then hlintPlan else null;
271247
};
272248
in hlint.components.exes.hlint
273249
```
274250

275251
Running when no building is needed is still slow in restricted evaluation mode.
276252

277253
```
278-
$ time nix-build --option restrict-eval true -I . --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" hlint.nix
279-
trace: Using index-state: 2019-12-03T00:00:00Z for hlint
280-
/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
281-
282-
real 0m10.066s
283-
user 0m8.563s
284-
sys 0m0.630s
285-
$ time nix-build hlint.nix
286-
/nix/store/7wwqq5v42gm6iiz2d3ngbnkyw7i4py11-hlint-2.2.4-exe-hlint
287-
288-
real 0m4.628s
289-
user 0m3.889s
290-
sys 0m0.389s
254+
$ time nix-build --option restrict-eval true -I . --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" hlint.nix --show-trace
255+
trace: Using index-state: 2020-04-15T00:00:00Z for hlint
256+
/nix/store/rnfz66v7k8i38c8rsmchzsyqjrmrbdpk-hlint-2.2.11-exe-hlint
257+
258+
real 0m4.463s
259+
user 0m4.440s
260+
sys 0m0.461s
261+
$ time nix-build hlint.nix
262+
/nix/store/rnfz66v7k8i38c8rsmchzsyqjrmrbdpk-hlint-2.2.11-exe-hlint
263+
264+
real 0m2.206s
265+
user 0m1.665s
266+
sys 0m0.332s
291267
```

lib/call-cabal-project-to-nix.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert, index-state-hashes, haskellLib, materialize }@defaults:
2-
{ name ? src.name or (baseNameOf src) # optional name for better error messages
2+
{ name ? src.name or 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
@@ -241,7 +241,7 @@ let
241241
chmod +w -R $out/.source-repository-packages
242242
rm -rf $out/.source-repository-packages
243243
fi
244-
find $out -type f ! -name '*.nix' -delete
244+
find $out \( -type f -or -type l \) ! -name '*.nix' -delete
245245
# Remove empty dirs
246246
find $out -type d -empty -delete
247247

lib/call-stack-to-nix.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
* see also `call-cabal-project-to-nix`!
77
*/
88
{ runCommand, nix-tools, pkgs, mkCacheFile, materialize }:
9-
{ src, stackYaml ? null, ignorePackageYaml ? false, cache ? null
9+
{ name ? src.name or null # optional name for better error messages
10+
, src
11+
, stackYaml ? null
12+
, ignorePackageYaml ? false
13+
, cache ? null
1014
, stack-sha256 ? null
1115
, materialized ? null # Location of a materialized copy of the nix files
1216
, checkMaterialization ? null # If true the nix files will be generated used to check plan-sha256 and material
@@ -25,7 +29,7 @@ let
2529
reasonNotSafe = null;
2630
} // pkgs.lib.optionalAttrs (checkMaterialization != null) {
2731
inherit checkMaterialization;
28-
}) (runCommand "stack-to-nix-pkgs" {
32+
}) (runCommand (if name == null then "stack-to-nix-pkgs" else name + "-stack-to-nix-pkgs") {
2933
nativeBuildInputs = [ nix-tools pkgs.nix-prefetch-git pkgs.cacert ];
3034
# Needed or stack-to-nix will die on unicode inputs
3135
LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.stdenv.hostPlatform.libc == "glibc") "${pkgs.glibcLocales}/lib/locale/locale-archive";

0 commit comments

Comments
 (0)