on iko/ghcjs-patch-master help sign in
Replace collectRunComponents with haskellLib.check (#316)
a9b0122Hamish Mackenzie
.buildkite/pipeline.yml+4−1
@@ -7,7 +7,10 @@ steps:
7 - label: 'Check that jobset will evaluate in Hydra'
7 - label: 'Check that jobset will evaluate in Hydra'
8 command:
8 command:
9 - nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
9 - nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh
10− - ./check-hydra.sh
10+ - ./check-hydra.sh 0
11+ - ./check-hydra.sh 1
12+ - ./check-hydra.sh 2
13+ - ./check-hydra.sh 3
11 agents:
14 agents:
12 system: x86_64-linux
15 system: x86_64-linux
13
16
build.nix+22−20
@@ -9,27 +9,19 @@
9, crossSystem ? null
9, crossSystem ? null
10, config ? {}
10, config ? {}
11, nixpkgsArgs ? { inherit system crossSystem; }
11, nixpkgsArgs ? { inherit system crossSystem; }
12+, ifdLevel ? 1000
12}:
13}:
13
14
14let
15let
15 haskellNixArgs = import ./default.nix;
16 haskellNixArgs = import ./default.nix;
16 pkgs = import nixpkgs ({
17 pkgs = import nixpkgs ({
17− config = haskellNixArgs.config // config;
18+ config = haskellNixArgs.config // config;
18− overlays = haskellNixArgs.overlays ++
19+ inherit (haskellNixArgs) overlays;
19− [(self: super: {
20− darcs = (self.haskell-nix.hackage-package {
21− name = "darcs";
22− version = "2.14.2";
23− index-state = "2019-10-28T00:00:00Z";
24− plan-sha256 = "1h8dxib0wz6mg8md6ldwa54dsr1dn7vxfij8cfhdawl4y3wr51k0";
25− # Apply the latest darcs.net Setup.hs patches
26− modules = [{packages.darcs.patches = [ ./patches/darcs-setup.patch ];}];
27− }).components.exes.darcs;
28− })]; } // nixpkgsArgs);
20+ } // nixpkgsArgs);
29 haskell = pkgs.haskell-nix;
21 haskell = pkgs.haskell-nix;
30
22
31in rec {
23in rec {
32− tests = import ./test/default.nix { inherit nixpkgs nixpkgsArgs; };
24+ tests = import ./test/default.nix { inherit nixpkgs nixpkgsArgs ifdLevel; };
33
25
34 # Scripts for keeping Hackage and Stackage up to date, and CI tasks.
26 # Scripts for keeping Hackage and Stackage up to date, and CI tasks.
35 # The dontRecurseIntoAttrs prevents these from building on hydra
27 # The dontRecurseIntoAttrs prevents these from building on hydra
@@ -52,6 +44,11 @@ in rec {
52 }) {};
44 }) {};
53 };
45 };
54 };
46 };
47+ # Because this is going to be used to test caching on hydra, it must not
48+ # use the darcs package from the haskell.nix we are testing. For that reason
49+ # it uses `pkgs.buildPackages.callPackage` not `haskell.callPackage`
50+ # (We could pull in darcs from a known good haskell.nix for hydra to
51+ # use)
55 check-hydra = pkgs.buildPackages.callPackage ./scripts/check-hydra.nix {};
52 check-hydra = pkgs.buildPackages.callPackage ./scripts/check-hydra.nix {};
56 check-closure-size = pkgs.buildPackages.callPackage ./scripts/check-closure-size.nix {
53 check-closure-size = pkgs.buildPackages.callPackage ./scripts/check-closure-size.nix {
57 inherit (haskell) nix-tools;
54 inherit (haskell) nix-tools;
@@ -60,11 +57,16 @@ in rec {
60
57
61 # These are pure parts of maintainer-script so they can be built by hydra
58 # These are pure parts of maintainer-script so they can be built by hydra
62 # and added to the cache to speed up buildkite.
59 # and added to the cache to speed up buildkite.
63− maintainer-script-cache = pkgs.recurseIntoAttrs {
60+ maintainer-script-cache = pkgs.recurseIntoAttrs (
61+ (pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isWindows {
62+ inherit (maintainer-scripts) check-hydra;
63+ })
64+ // (pkgs.lib.optionalAttrs (ifdLevel > 2) {
64− inherit (maintainer-scripts) update-docs check-hydra check-closure-size;
65+ inherit (maintainer-scripts) update-docs check-closure-size;
65− # Some of the dependencies of the impure scripts so that they will
66+ # Some of the dependencies of the impure scripts so that they will
66− # will be in the cache too for buildkite.
67+ # will be in the cache too for buildkite.
67− inherit (pkgs.buildPackages) glibc coreutils git openssh cabal-install nix-prefetch-git;
68+ inherit (pkgs.buildPackages) glibc coreutils git openssh cabal-install nix-prefetch-git;
68− inherit (haskell) nix-tools;
69+ inherit (haskell) nix-tools;
70+ })
69− };
71+ );
70}
72}
builder/comp-builder.nix+16−30
@@ -20,8 +20,6 @@
20, preHaddock ? component.preHaddock , postHaddock ? component.postHaddock
20, preHaddock ? component.preHaddock , postHaddock ? component.postHaddock
21, shellHook ? ""
21, shellHook ? ""
22
22
23−, doCheck ? component.doCheck || haskellLib.isTest componentId
24−, doCrossCheck ? component.doCrossCheck || false
25, dontPatchELF ? true
23, dontPatchELF ? true
26, dontStrip ? true
24, dontStrip ? true
27
25
@@ -128,13 +126,7 @@ let
128
126
129 exeExt = lib.optionalString stdenv.hostPlatform.isWindows ".exe";
127 exeExt = lib.optionalString stdenv.hostPlatform.isWindows ".exe";
130 testExecutable = "dist/build/${componentId.cname}/${componentId.cname}${exeExt}";
128 testExecutable = "dist/build/${componentId.cname}/${componentId.cname}${exeExt}";
131− # exe components are in /bin, but test and benchmarks are not. Perhaps to avoid
132− # them being from being added to the PATH when the all component added to an env.
133− # TODO revist this to find out why and document or maybe change this.
134− installedExeDir = if haskellLib.isTest componentId || haskellLib.isBenchmark componentId
135− then name
136− else "bin";
137− installedExe = "${installedExeDir}/${componentId.cname}${exeExt}";
129+ installedExe = "bin/${componentId.cname}${exeExt}";
138
130
139in stdenv.lib.fix (drv:
131in stdenv.lib.fix (drv:
140
132
@@ -143,20 +135,20 @@ stdenv.mkDerivation ({
143
135
144 src = cleanSrc;
136 src = cleanSrc;
145
137
138+ doCheck = false;
139+ doCrossCheck = false;
140+
146− inherit doCheck doCrossCheck dontPatchELF dontStrip;
141+ inherit dontPatchELF dontStrip;
147
142
148 passthru = {
143 passthru = {
149 inherit (package) identifier;
144 inherit (package) identifier;
150 config = component;
145 config = component;
151− inherit configFiles executableToolDepends cleanSrc;
146+ inherit configFiles executableToolDepends cleanSrc installedExe;
152 env = shellWrappers;
147 env = shellWrappers;
153
148
154 # The directory containing the haddock documentation.
149 # The directory containing the haddock documentation.
155 # `null' if no haddock documentation was built.
150 # `null' if no haddock documentation was built.
156 haddockDir = if doHaddock' then "${docdir drv.doc}/html" else null;
151 haddockDir = if doHaddock' then "${docdir drv.doc}/html" else null;
157− run = runCommand (fullName + "-run") {} ''
158− ${toString component.testWrapper} ${drv}/${installedExe} | tee $out
159− '';
160 };
152 };
161
153
162 meta = {
154 meta = {
@@ -217,13 +209,7 @@ stdenv.mkDerivation ({
217 runHook postBuild
209 runHook postBuild
218 '';
210 '';
219
211
220− checkPhase = ''
212+ checkPhase = "notice: Tests are only executed by building the .run sub-derivation of this component.";
221− runHook preCheck
222−
223− ${toString component.testWrapper} ${testExecutable} ${lib.concatStringsSep " " component.testFlags}
224−
225− runHook postCheck
226− '';
227
213
228 haddockPhase = ''
214 haddockPhase = ''
229 runHook preHaddock
215 runHook preHaddock
@@ -281,25 +267,25 @@ stdenv.mkDerivation ({
281 fi
267 fi
282 ''}
268 ''}
283 ${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
269 ${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
284− mkdir -p $out/${name}
270+ mkdir -p $out/bin
285 if [ -f ${testExecutable} ]; then
271 if [ -f ${testExecutable} ]; then
286− cp ${testExecutable} $out/${name}/
272+ cp ${testExecutable} $out/bin/
287 fi
273 fi
288 '')
274 '')
289 # In case `setup copy` did not creat this
275 # In case `setup copy` did not creat this
290 + (lib.optionalString enableSeparateDataOutput "mkdir -p $data")
276 + (lib.optionalString enableSeparateDataOutput "mkdir -p $data")
291 + (lib.optionalString (stdenv.hostPlatform.isWindows && (haskellLib.mayHaveExecutable componentId)) ''
277 + (lib.optionalString (stdenv.hostPlatform.isWindows && (haskellLib.mayHaveExecutable componentId)) ''
292− echo "Copying libffi and gmp .dlls ..."
278+ echo "Symlink libffi and gmp .dlls ..."
293 for p in ${lib.concatStringsSep " " [ libffi gmp ]}; do
279 for p in ${lib.concatStringsSep " " [ libffi gmp ]}; do
294− find "$p" -iname '*.dll' -exec cp {} $out/${installedExeDir} \;
280+ find "$p" -iname '*.dll' -exec ln -s {} $out/bin \;
295 done
281 done
296− # copy all .dlls into the local directory.
282+ # symlink all .dlls into the local directory.
297 # we ask ghc-pkg for *all* dynamic-library-dirs and then iterate over the unique set
283 # we ask ghc-pkg for *all* dynamic-library-dirs and then iterate over the unique set
298− # to copy over dlls as needed.
284+ # to symlink over dlls as needed.
299− echo "Copying library dependencies..."
285+ echo "Symlink library dependencies..."
300 for libdir in $(x86_64-pc-mingw32-ghc-pkg --package-db=$packageConfDir field "*" dynamic-library-dirs --simple-output|xargs|sed 's/ /\n/g'|sort -u); do
286 for libdir in $(x86_64-pc-mingw32-ghc-pkg --package-db=$packageConfDir field "*" dynamic-library-dirs --simple-output|xargs|sed 's/ /\n/g'|sort -u); do
301 if [ -d "$libdir" ]; then
287 if [ -d "$libdir" ]; then
302− find "$libdir" -iname '*.dll' -exec cp {} $out/${installedExeDir} \;
288+ find "$libdir" -iname '*.dll' -exec ln -s {} $out/bin \;
303 fi
289 fi
304 done
290 done
305 '')
291 '')
@@ -316,7 +302,7 @@ stdenv.mkDerivation ({
316// lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; }
302// lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; }
317// haskellLib.optionalHooks {
303// haskellLib.optionalHooks {
318 inherit preUnpack postUnpack preConfigure postConfigure
304 inherit preUnpack postUnpack preConfigure postConfigure
319− preBuild postBuild preCheck postCheck
305+ preBuild postBuild
320 preInstall postInstall preHaddock postHaddock;
306 preInstall postInstall preHaddock postHaddock;
321}
307}
322// lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${buildPackages.glibcLocales}/lib/locale/locale-archive"; }
308// lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${buildPackages.glibcLocales}/lib/locale/locale-archive"; }
builder/hspkg-builder.nix+4−1
@@ -57,8 +57,11 @@ let
57 ;
57 ;
58 };
58 };
59
59
60−in {
60+in rec {
61 components = haskellLib.applyComponents buildComp config;
61 components = haskellLib.applyComponents buildComp config;
62+ checks = pkgs.recurseIntoAttrs (builtins.mapAttrs
63+ (_: d: haskellLib.check d)
64+ (lib.filterAttrs (_: d: d.config.doCheck) components.tests));
62 inherit (package) identifier detailLevel isLocal;
65 inherit (package) identifier detailLevel isLocal;
63 inherit setup cabalFile;
66 inherit setup cabalFile;
64 isHaskell = true;
67 isHaskell = true;
docs/reference/library.md+17−1
@@ -286,7 +286,8 @@ Infrastructure.
286Extracts a selection of components from a Haskell [package set](#package-set).
286Extracts a selection of components from a Haskell [package set](#package-set).
287
287
288This can be used to filter out all test suites or benchmarks of
288This can be used to filter out all test suites or benchmarks of
289−your project, so that they can be built in Hydra.
289+your project, so that they can be built in Hydra (see check if you
290+waht to run the tests as well as build them).
290
291
291```
292```
292collectComponents =
293collectComponents =
@@ -311,6 +312,21 @@ tests = collectComponents "tests" (package: package.identifier.name == "mypackag
311Will result in moving derivations from `hsPkgs.mypackage.components.tests.unit-tests`
312Will result in moving derivations from `hsPkgs.mypackage.components.tests.unit-tests`
312to `tests.mypackage.unit-tests`.
313to `tests.mypackage.unit-tests`.
313
314
315+#### check
316+
317+This function turns a derivation that builds a test into one to run it.
318+
319+| Argument | Type | Description |
320+|-------------------|--------|---------------------|
321+| `drv` | Derivation | One of `$pkg.components.tests.$test`. |
322+
323+For convenience `$pkg.components.tests` are mapped with this function
324+to `$pkg.components.checks`.
325+
326+This function is intended for use with `tests` but it should also work
327+for `exes` and `benchmarks` if you just want to run them to make sure
328+they execute.
329+
314#### subComponentTypes
330#### subComponentTypes
315
331
316Sub-component types identify [components](#component) and are one of:
332Sub-component types identify [components](#component) and are one of:
lib/call-cabal-project-to-nix.nix+2−1
@@ -156,10 +156,11 @@ let
156 }
156 }
157 else replaceSoureRepos rawCabalProject;
157 else replaceSoureRepos rawCabalProject;
158
158
159− plan-nix = runCommand "plan-to-nix-pkgs" ({
159+ plan-nix = runCommand (if name == null then "plan-to-nix-pkgs" else name + "-plan-to-nix-pkgs") ({
160 nativeBuildInputs = [ nix-tools ghc hpack cabal-install pkgs.rsync pkgs.git ];
160 nativeBuildInputs = [ nix-tools ghc hpack cabal-install pkgs.rsync pkgs.git ];
161 # Needed or stack-to-nix will die on unicode inputs
161 # Needed or stack-to-nix will die on unicode inputs
162 LANG = "en_US.UTF-8";
162 LANG = "en_US.UTF-8";
163+ preferLocalBuild = false;
163 } // (if plan-sha256 == null
164 } // (if plan-sha256 == null
164 then {}
165 then {}
165 else {
166 else {
lib/call-stack-to-nix.nix+1
@@ -20,6 +20,7 @@ let
20 LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.stdenv.hostPlatform.libc == "glibc") "${pkgs.glibcLocales}/lib/locale/locale-archive";
20 LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.stdenv.hostPlatform.libc == "glibc") "${pkgs.glibcLocales}/lib/locale/locale-archive";
21 LANG = "en_US.UTF-8";
21 LANG = "en_US.UTF-8";
22 LC_ALL = "en_US.UTF-8";
22 LC_ALL = "en_US.UTF-8";
23+ preferLocalBuild = false;
23 } (''
24 } (''
24 mkdir -p $out
25 mkdir -p $out
25 '' + pkgs.lib.optionalString (cache != null) ''
26 '' + pkgs.lib.optionalString (cache != null) ''
lib/check.nixnew file+42
@@ -0,0 +1,42 @@
1+{ stdenv, lib, haskellLib, srcOnly }:
2+drv:
3+
4+let
5+ component = drv.config;
6+
7+# This derivation can be used to execute test component.
8+# The $out of the derivation is a file containing the resulting
9+# stdout output.
10+in stdenv.mkDerivation ({
11+ name = (drv.name + "-check");
12+
13+ # Useing `srcOnly` (rather than getting the `src` via a `drv.passthru`)
14+ # should correctly apply the patches from `drv` (if any).
15+ src = srcOnly drv;
16+
17+ passthru = {
18+ inherit (drv) identifier config configFiles executableToolDepends cleanSrc env;
19+ };
20+
21+ inherit (drv) meta LANG LC_ALL;
22+
23+ inherit (component) doCheck doCrossCheck;
24+
25+ phases = ["buildPhase" "checkPhase"];
26+
27+ # If doCheck or doCrossCheck are false we may still build this
28+ # component and we want it to quietly succeed.
29+ buildPhase = ''
30+ touch $out
31+ '';
32+
33+ checkPhase = ''
34+ runHook preCheck
35+
36+ ${toString component.testWrapper} ${drv}/${drv.installedExe} ${lib.concatStringsSep " " component.testFlags} | tee $out
37+
38+ runHook postCheck
39+ '';
40+} // haskellLib.optionalHooks {
41+ inherit (component) preCheck postCheck;
42+})
lib/default.nix+6−1
@@ -1,4 +1,4 @@
1−{ lib, haskellLib, runCommand, git }:
1+{ stdenv, lib, haskellLib, runCommand, git, srcOnly }:
2
2
3with haskellLib;
3with haskellLib;
4
4
@@ -149,4 +149,9 @@ with haskellLib;
149 cleanGit = import ./clean-git.nix {
149 cleanGit = import ./clean-git.nix {
150 inherit lib runCommand git cleanSourceWith;
150 inherit lib runCommand git cleanSourceWith;
151 };
151 };
152+
153+ # Check a test component
154+ check = import ./check.nix {
155+ inherit stdenv lib haskellLib srcOnly;
156+ };
152}
157}
modules/plan.nix+1−1
@@ -81,7 +81,7 @@ let
81 };
81 };
82 doCheck = mkOption {
82 doCheck = mkOption {
83 type = bool;
83 type = bool;
84− default = (def.doCheck or false);
84+ default = (def.doCheck or true);
85 };
85 };
86 doCrossCheck = mkOption {
86 doCrossCheck = mkOption {
87 description = "Run doCheck also in cross compilation settings. This can be tricky as the test logic must know how to run the tests on the target.";
87 description = "Run doCheck also in cross compilation settings. This can be tricky as the test logic must know how to run the tests on the target.";
overlays/bootstrap.nix+3−3
@@ -267,7 +267,7 @@ self: super: {
267 index-state = "2019-10-20T00:00:00Z";
267 index-state = "2019-10-20T00:00:00Z";
268 plan-sha256 = "086kd6aa5bir3y4aqb1wl5zkj6agz5q4wp4snvdnf6cidz5wra06";
268 plan-sha256 = "086kd6aa5bir3y4aqb1wl5zkj6agz5q4wp4snvdnf6cidz5wra06";
269 };
269 };
270− alex = bootstrap.packages.alex-project.alex.components.exes.alex;
270+ alex = bootstrap.packages.alex-project.hsPkgs.alex.components.exes.alex;
271 happy-project = hackage-project {
271 happy-project = hackage-project {
272 # Only a boot compiler is suitable here
272 # Only a boot compiler is suitable here
273 ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
273 ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
@@ -276,7 +276,7 @@ self: super: {
276 index-state = "2019-10-20T00:00:00Z";
276 index-state = "2019-10-20T00:00:00Z";
277 plan-sha256 = "011bxlxdv239psgi80j00km2wcgb68j16sz3fng67d03sqf5i37w";
277 plan-sha256 = "011bxlxdv239psgi80j00km2wcgb68j16sz3fng67d03sqf5i37w";
278 };
278 };
279− happy = bootstrap.packages.happy-project.happy.components.exes.happy;
279+ happy = bootstrap.packages.happy-project.hsPkgs.happy.components.exes.happy;
280 hscolour-project = hackage-project {
280 hscolour-project = hackage-project {
281 # Only a boot compiler is suitable here
281 # Only a boot compiler is suitable here
282 ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
282 ghc = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
@@ -285,7 +285,7 @@ self: super: {
285 index-state = "2019-10-20T00:00:00Z";
285 index-state = "2019-10-20T00:00:00Z";
286 plan-sha256 = "021rwcmkshibc3mfr833ay5hfr19kq6k32lxyrrb6vp9vmihgw4b";
286 plan-sha256 = "021rwcmkshibc3mfr833ay5hfr19kq6k32lxyrrb6vp9vmihgw4b";
287 };
287 };
288− hscolour = bootstrap.packages.hscolour-project.hscolour.components.exes.HsColour;
288+ hscolour = bootstrap.packages.hscolour-project.hsPkgs.hscolour.components.exes.HsColour;
289 };
289 };
290 };
290 };
291 };
291 };
overlays/haskell.nix+30−21
@@ -59,7 +59,7 @@ self: super: {
59
59
60 # Utility functions for working with the component builder.
60 # Utility functions for working with the component builder.
61 haskellLib = let hl = import ../lib {
61 haskellLib = let hl = import ../lib {
62− inherit (self) lib runCommand;
62+ inherit (self) stdenv lib runCommand srcOnly;
63 inherit (self.buildPackages) git;
63 inherit (self.buildPackages) git;
64 haskellLib = hl;
64 haskellLib = hl;
65 }; in hl;
65 }; in hl;
@@ -309,7 +309,7 @@ self: super: {
309 tar xzf ${tarball}
309 tar xzf ${tarball}
310 mv "${name}-${version}" $out
310 mv "${name}-${version}" $out
311 '';
311 '';
312− in cabalProject (builtins.removeAttrs args [ "version" ] // { inherit src; });
312+ in cabalProject' (builtins.removeAttrs args [ "version" ] // { inherit src; });
313
313
314 # This function is like `cabalProject` but it makes the plan-nix available
314 # This function is like `cabalProject` but it makes the plan-nix available
315 # separately from the hsPkgs. The advantage is that the you can get the
315 # separately from the hsPkgs. The advantage is that the you can get the
@@ -361,27 +361,36 @@ self: super: {
361 # project = cabalProject' {...};
361 # project = cabalProject' {...};
362 # In your tests module add something that is effectively
362 # In your tests module add something that is effectively
363 # testProjectPlan = withInputs project.plan-nix;
363 # testProjectPlan = withInputs project.plan-nix;
364− withInputs = derivation: builtins.mapAttrs (_: self.recurseIntoAttrs) {
364+ withInputs = self.recurseIntoAttrs;
365− inherit derivation;
366− inputs = builtins.listToAttrs (
367− builtins.concatMap (i: if i == null then [] else [
368− { name = builtins.replaceStrings ["." (self.stdenv.hostPlatform.config + "-")] ["_" ""] i.name; value = i; }
369− ]) derivation.nativeBuildInputs);
370− };
371
365
372 # Add this to your tests to make all the dependencies of haskell.nix
366 # Add this to your tests to make all the dependencies of haskell.nix
373 # are tested and cached.
367 # are tested and cached.
374− haskellNixRoots = self.recurseIntoAttrs (builtins.mapAttrs (_: self.recurseIntoAttrs) {
368+ haskellNixRoots = self.recurseIntoAttrs {
369+ Level0 = haskellNixRoots' 0;
370+ Level1 = haskellNixRoots' 1;
371+ };
372+
373+ haskellNixRoots' = ifdLevel:
374+ let filterSupportedGhc = self.lib.filterAttrs (n: _: n == "ghc865");
375+ in self.recurseIntoAttrs ({
376+ # Things that require no IFD to build
375− inherit (self.buildPackages.haskell-nix) nix-tools source-pins;
377+ inherit (self.buildPackages.haskell-nix) nix-tools source-pins;
376− bootstap-nix-tools = self.buildPackages.haskell-nix.bootstrap.packages.nix-tools;
378+ bootstap-nix-tools = self.buildPackages.haskell-nix.bootstrap.packages.nix-tools;
377− alex-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.alex-project.plan-nix;
379+ alex-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.alex-project.plan-nix;
378− happy-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.happy-project.plan-nix;
380+ happy-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.happy-project.plan-nix;
379− hscolour-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.hscolour-project.plan-nix;
381+ hscolour-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.hscolour-project.plan-nix;
382+ } // self.lib.optionalAttrs (ifdLevel > 0) {
383+ # Things that require one IFD to build (the inputs should be in level 0)
384+ alex = self.buildPackages.haskell-nix.bootstrap.packages.alex;
385+ happy = self.buildPackages.haskell-nix.bootstrap.packages.happy;
386+ hscolour = self.buildPackages.haskell-nix.bootstrap.packages.hscolour;
387+ ghc865 = self.buildPackages.haskell-nix.compiler.ghc865;
380− ghc-extra-projects = builtins.mapAttrs (_: proj: self.recurseIntoAttrs (withInputs proj.plan-nix))
388+ ghc-extra-projects = self.recurseIntoAttrs (builtins.mapAttrs (_: proj: withInputs proj.plan-nix)
381− (self.lib.filterAttrs (n: _: n != "ghc844" && n != "ghc861" && n != "ghc862"
389+ (filterSupportedGhc self.ghc-extra-projects));
382− # There is an issue with GHC 8.6.4 and nixpkgs 19.09, so only build it for 19.03 for now
390+ } // self.lib.optionalAttrs (ifdLevel > 1) {
383− && (n != "ghc864" || super.lib.versions.majorMinor super.lib.version == "19.03")
391+ # Things that require two levels of IFD to build (inputs should be in level 1)
392+ ghc-extra-packages = self.recurseIntoAttrs
384− ) self.ghc-extra-projects);
393+ (filterSupportedGhc self.ghc-extra-packages);
385− });
394+ });
386 };
395 };
387}
396}
package-set.nix+1−1
@@ -7,7 +7,7 @@ in pkgs.lib.evalModules {
7 _module.args = {
7 _module.args = {
8 # this is *not* the hasekllLib from nixpkgs; it is rather our own
8 # this is *not* the hasekllLib from nixpkgs; it is rather our own
9 # library from haskell.nix
9 # library from haskell.nix
10− haskellLib = let hl = import ./lib { inherit lib; inherit (pkgs) runCommand git; haskellLib = hl; }; in hl;
10+ haskellLib = let hl = import ./lib { inherit lib; inherit (pkgs) stdenv runCommand git srcOnly; haskellLib = hl; }; in hl;
11
11
12 # The package descriptions depend on pkgs, which are used to resolve system package dependencies
12 # The package descriptions depend on pkgs, which are used to resolve system package dependencies
13 # as well as pkgconfPkgs, which are used to resolve pkgconfig name to nixpkgs names. We simply
13 # as well as pkgconfPkgs, which are used to resolve pkgconfig name to nixpkgs names. We simply
release.nix+2
@@ -2,6 +2,7 @@
2, scrubJobs ? true
2, scrubJobs ? true
3, haskell-nix ? { outPath = ./.; rev = "abcdef"; }
3, haskell-nix ? { outPath = ./.; rev = "abcdef"; }
4, nixpkgsArgs ? {}
4, nixpkgsArgs ? {}
5+, ifdLevel ? 3
5}:
6}:
6
7
7let defaultNixpkgs = import ./nixpkgs {}; in
8let defaultNixpkgs = import ./nixpkgs {}; in
@@ -31,6 +32,7 @@ let
31 , ...}@args:
32 , ...}@args:
32 import (haskell-nix + /build.nix) (args // {
33 import (haskell-nix + /build.nix) (args // {
33 nixpkgsArgs = nixpkgsArgs // { inherit nixpkgs-pin; };
34 nixpkgsArgs = nixpkgsArgs // { inherit nixpkgs-pin; };
35+ inherit ifdLevel;
34 });
36 });
35 });
37 });
36
38
scripts/check-hydra.nix+2−1
@@ -9,11 +9,12 @@ writeScript "check-hydra.sh" ''
9
9
10 export PATH="${makeBinPath [ coreutils time gnutar gzip hydra jq ]}"
10 export PATH="${makeBinPath [ coreutils time gnutar gzip hydra jq ]}"
11
11
12− echo '~~~ Evaluating release.nix'
12+ echo '~~~ Evaluating release.nix with --arg ifdLevel '$1
13 command time --format '%e' -o eval-time.txt \
13 command time --format '%e' -o eval-time.txt \
14 hydra-eval-jobs \
14 hydra-eval-jobs \
15 --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
15 --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
16 --arg supportedSystems '[ builtins.currentSystem ]' \
16 --arg supportedSystems '[ builtins.currentSystem ]' \
17+ --arg ifdLevel $1 \
17 -I . release.nix > eval.json
18 -I . release.nix > eval.json
18 EVAL_EXIT_CODE="$?"
19 EVAL_EXIT_CODE="$?"
19 if [ "$EVAL_EXIT_CODE" != 0 ]
20 if [ "$EVAL_EXIT_CODE" != 0 ]
test/buildable/default.nix+4−2
@@ -12,14 +12,16 @@ let
12 packages = project.hsPkgs;
12 packages = project.hsPkgs;
13
13
14in recurseIntoAttrs {
14in recurseIntoAttrs {
15+ ifdInputs = {
15− inherit (project) plan-nix;
16+ inherit (project) plan-nix;
17+ };
16 run = stdenv.mkDerivation {
18 run = stdenv.mkDerivation {
17 name = "buildable-test";
19 name = "buildable-test";
18
20
19 buildCommand =
21 buildCommand =
20 (concatStrings (mapAttrsToList (name: value: ''
22 (concatStrings (mapAttrsToList (name: value: ''
21 printf "checking whether executable runs... " >& 2
23 printf "checking whether executable runs... " >& 2
22− cat ${value.run}
24+ cat ${haskellLib.check value}
23 '') packages.buildable-test.components.exes)) + ''
25 '') packages.buildable-test.components.exes)) + ''
24 touch $out
26 touch $out
25 '';
27 '';
test/cabal-22/default.nix+6−4
@@ -11,7 +11,9 @@ let
11 packages = project.hsPkgs;
11 packages = project.hsPkgs;
12
12
13in recurseIntoAttrs {
13in recurseIntoAttrs {
14+ ifdInputs = {
14− inherit (project) plan-nix;
15+ inherit (project) plan-nix;
16+ };
15 shell = util.addCabalInstall packages.project.components.all;
17 shell = util.addCabalInstall packages.project.components.all;
16 run = stdenv.mkDerivation {
18 run = stdenv.mkDerivation {
17 name = "cabal-22-test";
19 name = "cabal-22-test";
@@ -24,7 +26,7 @@ in recurseIntoAttrs {
24
26
25 # fixme: run on target platform when cross-compiled
27 # fixme: run on target platform when cross-compiled
26 printf "checking whether executable rans... " >& 2
28 printf "checking whether executable rans... " >& 2
27− cat ${packages.project.components.exes.project.run}
29+ cat ${haskellLib.check packages.project.components.exes.project}
28
30
29 printf "checking that executable is dynamically linked to system libraries... " >& 2
31 printf "checking that executable is dynamically linked to system libraries... " >& 2
30 '' + optionalString stdenv.isLinux ''
32 '' + optionalString stdenv.isLinux ''
@@ -50,10 +52,10 @@ in recurseIntoAttrs {
50 touch $out
52 touch $out
51
53
52 printf "checking whether benchmark ran... " >& 2
54 printf "checking whether benchmark ran... " >& 2
53− cat ${packages.project.components.benchmarks.project-bench.run}
55+ cat ${haskellLib.check packages.project.components.benchmarks.project-bench}
54
56
55 printf "checking whether tests ran... " >& 2
57 printf "checking whether tests ran... " >& 2
56− cat ${packages.project.components.tests.unit.run}
58+ cat ${haskellLib.check packages.project.components.tests.unit}
57 '';
59 '';
58
60
59 meta.platforms = platforms.all;
61 meta.platforms = platforms.all;
test/cabal-simple-prof/default.nix+3−1
@@ -24,7 +24,9 @@ let
24 packages = project.hsPkgs;
24 packages = project.hsPkgs;
25
25
26in recurseIntoAttrs {
26in recurseIntoAttrs {
27+ ifdInputs = {
27− inherit (project) plan-nix;
28+ inherit (project) plan-nix;
29+ };
28 run = stdenv.mkDerivation {
30 run = stdenv.mkDerivation {
29 name = "cabal-simple-prof-test";
31 name = "cabal-simple-prof-test";
30
32
test/cabal-simple/default.nix+4−2
@@ -34,7 +34,9 @@ let
34 packages = project.hsPkgs;
34 packages = project.hsPkgs;
35
35
36in recurseIntoAttrs {
36in recurseIntoAttrs {
37+ ifdInputs = {
37− inherit (project) plan-nix;
38+ inherit (project) plan-nix;
39+ };
38
40
39 # Used for testing externally with nix-shell (../tests.sh).
41 # Used for testing externally with nix-shell (../tests.sh).
40 # This just adds cabal-install to the existing shells.
42 # This just adds cabal-install to the existing shells.
@@ -51,7 +53,7 @@ in recurseIntoAttrs {
51
53
52 # fixme: run on target platform when cross-compiled
54 # fixme: run on target platform when cross-compiled
53 printf "checking whether executable runs... " >& 2
55 printf "checking whether executable runs... " >& 2
54− cat ${packages.cabal-simple.components.exes.cabal-simple.run}
56+ cat ${haskellLib.check packages.cabal-simple.components.exes.cabal-simple}
55 '' + (if stdenv.hostPlatform.isMusl then ''
57 '' + (if stdenv.hostPlatform.isMusl then ''
56 printf "checking that executable is statically linked... " >& 2
58 printf "checking that executable is statically linked... " >& 2
57 (ldd $exe 2>&1 || true) | grep -i "not a"
59 (ldd $exe 2>&1 || true) | grep -i "not a"
test/cabal-source-repo/default.nix+5−3
@@ -1,4 +1,4 @@
1−{ stdenv, cabalProject', recurseIntoAttrs }:
1+{ stdenv, cabalProject', recurseIntoAttrs, haskellLib }:
2
2
3with stdenv.lib;
3with stdenv.lib;
4
4
@@ -10,7 +10,9 @@ let
10 };
10 };
11 packages = project.hsPkgs;
11 packages = project.hsPkgs;
12in recurseIntoAttrs {
12in recurseIntoAttrs {
13+ ifdInputs = {
13− inherit (project) plan-nix;
14+ inherit (project) plan-nix;
15+ };
14 run = stdenv.mkDerivation {
16 run = stdenv.mkDerivation {
15 name = "call-cabal-project-to-nix-test";
17 name = "call-cabal-project-to-nix-test";
16
18
@@ -18,7 +20,7 @@ in recurseIntoAttrs {
18 exe="${packages.use-cabal-simple.components.exes.use-cabal-simple}/bin/use-cabal-simple${stdenv.hostPlatform.extensions.executable}"
20 exe="${packages.use-cabal-simple.components.exes.use-cabal-simple}/bin/use-cabal-simple${stdenv.hostPlatform.extensions.executable}"
19
21
20 printf "checking whether executable runs... " >& 2
22 printf "checking whether executable runs... " >& 2
21− cat ${packages.use-cabal-simple.components.exes.use-cabal-simple.run}
23+ cat ${haskellLib.check packages.use-cabal-simple.components.exes.use-cabal-simple}
22
24
23 touch $out
25 touch $out
24 '';
26 '';
test/cabal-sublib/default.nix+4−2
@@ -22,7 +22,9 @@ let
22 packages = project.hsPkgs;
22 packages = project.hsPkgs;
23
23
24in recurseIntoAttrs {
24in recurseIntoAttrs {
25+ ifdInputs = {
25− inherit (project) plan-nix;
26+ inherit (project) plan-nix;
27+ };
26 run = stdenv.mkDerivation {
28 run = stdenv.mkDerivation {
27 name = "cabal-sublib-test";
29 name = "cabal-sublib-test";
28
30
@@ -34,7 +36,7 @@ in recurseIntoAttrs {
34
36
35 # fixme: run on target platform when cross-compiled
37 # fixme: run on target platform when cross-compiled
36 printf "checking whether executable runs... " >& 2
38 printf "checking whether executable runs... " >& 2
37− cat ${packages.cabal-sublib.components.exes.cabal-sublib.run}
39+ cat ${haskellLib.check packages.cabal-sublib.components.exes.cabal-sublib}
38
40
39 printf "checking that executable is dynamically linked to system libraries... " >& 2
41 printf "checking that executable is dynamically linked to system libraries... " >& 2
40 '' + optionalString stdenv.isLinux ''
42 '' + optionalString stdenv.isLinux ''
test/call-cabal-project-to-nix/default.nix+5−3
@@ -1,4 +1,4 @@
1−{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject, recurseIntoAttrs }:
1+{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject, recurseIntoAttrs, haskellLib }:
2
2
3with stdenv.lib;
3with stdenv.lib;
4
4
@@ -17,7 +17,9 @@ let
17 packages = pkgSet.config.hsPkgs;
17 packages = pkgSet.config.hsPkgs;
18
18
19in recurseIntoAttrs {
19in recurseIntoAttrs {
20+ ifdInputs = {
20− plan-nix = plan.nix;
21+ plan-nix = plan.nix;
22+ };
21 run = stdenv.mkDerivation {
23 run = stdenv.mkDerivation {
22 name = "call-cabal-project-to-nix-test";
24 name = "call-cabal-project-to-nix-test";
23
25
@@ -25,7 +27,7 @@ in recurseIntoAttrs {
25 exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
27 exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
26
28
27 printf "checking whether executable runs... " >& 2
29 printf "checking whether executable runs... " >& 2
28− cat ${packages.cabal-simple.components.exes.cabal-simple.run}
30+ cat ${haskellLib.check packages.cabal-simple.components.exes.cabal-simple}
29
31
30 touch $out
32 touch $out
31 '';
33 '';
test/call-stack-to-nix/default.nix+5−3
@@ -1,4 +1,4 @@
1−{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject, recurseIntoAttrs }:
1+{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject, recurseIntoAttrs, haskellLib }:
2
2
3with stdenv.lib;
3with stdenv.lib;
4
4
@@ -14,7 +14,9 @@ let
14 packages = pkgSet.config.hsPkgs;
14 packages = pkgSet.config.hsPkgs;
15
15
16in recurseIntoAttrs {
16in recurseIntoAttrs {
17+ ifdInputs = {
17− stack-nix = stack.nix;
18+ stack-nix = stack.nix;
19+ };
18 run = stdenv.mkDerivation {
20 run = stdenv.mkDerivation {
19 name = "callStackToNix-test";
21 name = "callStackToNix-test";
20
22
@@ -22,7 +24,7 @@ in recurseIntoAttrs {
22 exe="${packages.stack-simple.components.exes.stack-simple-exe}/bin/stack-simple-exe${stdenv.hostPlatform.extensions.executable}"
24 exe="${packages.stack-simple.components.exes.stack-simple-exe}/bin/stack-simple-exe${stdenv.hostPlatform.extensions.executable}"
23
25
24 printf "checking whether executable runs... " >& 2
26 printf "checking whether executable runs... " >& 2
25− cat ${packages.stack-simple.components.exes.stack-simple-exe.run}
27+ cat ${haskellLib.check packages.stack-simple.components.exes.stack-simple-exe}
26
28
27 touch $out
29 touch $out
28 '';
30 '';
test/default.nix+11−2
@@ -1,14 +1,23 @@
1{ pkgs ? import nixpkgs ((import ../.) // nixpkgsArgs)
1{ pkgs ? import nixpkgs ((import ../.) // nixpkgsArgs)
2, nixpkgs ? ../nixpkgs
2, nixpkgs ? ../nixpkgs
3, nixpkgsArgs ? { }
3, nixpkgsArgs ? { }
4+, ifdLevel ? 1000
4}:
5}:
5
6
6with pkgs;
7with pkgs;
7
8
8let
9let
10+ withIfdInputs = builtins.mapAttrs (n: x:
11+ if n == "ifdInputs"
12+ then pkgs.recurseIntoAttrs (builtins.mapAttrs (_: pkgs.haskell-nix.withInputs) x)
13+ else x);
9 util = import ./util.nix { inherit (pkgs.haskell-nix) cabal-install; };
14 util = import ./util.nix { inherit (pkgs.haskell-nix) cabal-install; };
10in pkgs.recurseIntoAttrs {
15in pkgs.recurseIntoAttrs {
11− inherit (haskell-nix) haskellNixRoots;
16+ haskellNixRoots = haskell-nix.haskellNixRoots' ifdLevel;
17+} // pkgs.lib.optionalAttrs (ifdLevel > 1) (
18+ builtins.mapAttrs (_: y: withIfdInputs y) ((if ifdLevel < 3
19+ then builtins.mapAttrs (_: d: pkgs.recurseIntoAttrs (pkgs.lib.filterAttrs (n: _: n == "ifdInputs") d))
20+ else x: x) {
12 cabal-simple = haskell-nix.callPackage ./cabal-simple { inherit util; };
21 cabal-simple = haskell-nix.callPackage ./cabal-simple { inherit util; };
13 cabal-simple-prof = haskell-nix.callPackage ./cabal-simple-prof { inherit util; };
22 cabal-simple-prof = haskell-nix.callPackage ./cabal-simple-prof { inherit util; };
14 cabal-sublib = haskell-nix.callPackage ./cabal-sublib { inherit util; };
23 cabal-sublib = haskell-nix.callPackage ./cabal-sublib { inherit util; };
@@ -38,7 +47,7 @@ in pkgs.recurseIntoAttrs {
38 in runCommand "unit-tests" { passthru = { inherit tests; }; }
47 in runCommand "unit-tests" { passthru = { inherit tests; }; }
39 (lib.concatMapStringsSep "\n" (t: "echo ${t.name} failed") tests +
48 (lib.concatMapStringsSep "\n" (t: "echo ${t.name} failed") tests +
40 (if builtins.length tests == 0 then "\ntouch $out" else "\nexit 1"));
49 (if builtins.length tests == 0 then "\ntouch $out" else "\nexit 1"));
41−}
50+}))
42
51
43## more possible test cases
52## more possible test cases
44# 1. fully static linking
53# 1. fully static linking
test/exe-only/default.nix+5−3
@@ -1,5 +1,5 @@
1# Test a package set
1# Test a package set
2−{ stdenv, util, haskell-nix, recurseIntoAttrs }:
2+{ stdenv, util, haskell-nix, recurseIntoAttrs, haskellLib }:
3
3
4with stdenv.lib;
4with stdenv.lib;
5
5
@@ -12,7 +12,9 @@ let
12 packages = project.hsPkgs;
12 packages = project.hsPkgs;
13
13
14in recurseIntoAttrs {
14in recurseIntoAttrs {
15+ ifdInputs = {
15− inherit (project) plan-nix;
16+ inherit (project) plan-nix;
17+ };
16 run = stdenv.mkDerivation {
18 run = stdenv.mkDerivation {
17 name = "exe-only-test";
19 name = "exe-only-test";
18
20
@@ -24,7 +26,7 @@ in recurseIntoAttrs {
24
26
25 # fixme: run on target platform when cross-compiled
27 # fixme: run on target platform when cross-compiled
26 printf "checking whether executable ran... " >& 2
28 printf "checking whether executable ran... " >& 2
27− cat ${packages.exe-only.components.exes.exe-only.run}
29+ cat ${haskellLib.check packages.exe-only.components.exes.exe-only}
28 '' + (if stdenv.hostPlatform.isMusl then ''
30 '' + (if stdenv.hostPlatform.isMusl then ''
29 printf "checking that executable is statically linked... " >& 2
31 printf "checking that executable is statically linked... " >& 2
30 (ldd $exe 2>&1 || true) | grep -i "not a"
32 (ldd $exe 2>&1 || true) | grep -i "not a"
test/fully-static/default.nix+4−2
@@ -53,8 +53,10 @@ let
53 packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
53 packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
54
54
55in recurseIntoAttrs {
55in recurseIntoAttrs {
56+ ifdInputs = {
56− stack-nix-gmp = (project { gpl = true; }).stack-nix;
57+ stack-nix-gmp = (project { gpl = true; }).stack-nix;
57− stack-nix-simple = (project { gpl = false; }).stack-nix;
58+ stack-nix-simple = (project { gpl = false; }).stack-nix;
59+ };
58 run = stdenv.mkDerivation {
60 run = stdenv.mkDerivation {
59 name = "fully-static-test";
61 name = "fully-static-test";
60
62
test/ghc-options/cabal.nix+5−3
@@ -1,4 +1,4 @@
1−{ stdenv, cabalProject', recurseIntoAttrs }:
1+{ stdenv, cabalProject', recurseIntoAttrs, haskellLib }:
2
2
3with stdenv.lib;
3with stdenv.lib;
4
4
@@ -13,13 +13,15 @@ let
13 packages = project.hsPkgs;
13 packages = project.hsPkgs;
14
14
15in recurseIntoAttrs {
15in recurseIntoAttrs {
16+ ifdInputs = {
16− inherit (project) plan-nix;
17+ inherit (project) plan-nix;
18+ };
17 run = stdenv.mkDerivation {
19 run = stdenv.mkDerivation {
18 name = "call-cabal-project-to-nix-test";
20 name = "call-cabal-project-to-nix-test";
19
21
20 buildCommand = ''
22 buildCommand = ''
21 printf "checking whether executable runs... " >& 2
23 printf "checking whether executable runs... " >& 2
22− cat ${packages.test-ghc-options.components.exes.test-ghc-options-exe.run}
24+ cat ${haskellLib.check packages.test-ghc-options.components.exes.test-ghc-options-exe}
23
25
24 touch $out
26 touch $out
25 '';
27 '';
test/ghc-options/stack.nix+5−3
@@ -1,4 +1,4 @@
1−{ stdenv, stackProject', recurseIntoAttrs }:
1+{ stdenv, stackProject', recurseIntoAttrs, haskellLib }:
2
2
3with stdenv.lib;
3with stdenv.lib;
4
4
@@ -9,13 +9,15 @@ let
9 packages = project.hsPkgs;
9 packages = project.hsPkgs;
10
10
11in recurseIntoAttrs {
11in recurseIntoAttrs {
12+ ifdInputs = {
12− inherit (project) stack-nix;
13+ inherit (project) stack-nix;
14+ };
13 run = stdenv.mkDerivation {
15 run = stdenv.mkDerivation {
14 name = "callStackToNix-test";
16 name = "callStackToNix-test";
15
17
16 buildCommand = ''
18 buildCommand = ''
17 printf "checking whether executable runs... " >& 2
19 printf "checking whether executable runs... " >& 2
18− cat ${packages.test-ghc-options.components.exes.test-ghc-options-exe.run}
20+ cat ${haskellLib.check packages.test-ghc-options.components.exes.test-ghc-options-exe}
19
21
20 touch $out
22 touch $out
21 '';
23 '';
test/project-flags/cabal.nix+5−3
@@ -1,4 +1,4 @@
1−{ stdenv, cabalProject', recurseIntoAttrs }:
1+{ stdenv, cabalProject', recurseIntoAttrs, haskellLib }:
2
2
3with stdenv.lib;
3with stdenv.lib;
4
4
@@ -11,7 +11,9 @@ let
11 packages = project.hsPkgs;
11 packages = project.hsPkgs;
12
12
13in recurseIntoAttrs {
13in recurseIntoAttrs {
14+ ifdInputs = {
14− inherit (project) plan-nix;
15+ inherit (project) plan-nix;
16+ };
15 run = stdenv.mkDerivation {
17 run = stdenv.mkDerivation {
16 name = "call-cabal-project-to-nix-test";
18 name = "call-cabal-project-to-nix-test";
17
19
@@ -19,7 +21,7 @@ in recurseIntoAttrs {
19 exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe${stdenv.hostPlatform.extensions.executable}"
21 exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe${stdenv.hostPlatform.extensions.executable}"
20
22
21 printf "checking whether executable runs... " >& 2
23 printf "checking whether executable runs... " >& 2
22− cat ${packages.test-project-flags.components.exes.test-project-flags-exe.run}
24+ cat ${haskellLib.check packages.test-project-flags.components.exes.test-project-flags-exe}
23
25
24 touch $out
26 touch $out
25 '';
27 '';
test/project-flags/stack.nix+5−3
@@ -1,4 +1,4 @@
1−{ stdenv, stackProject', recurseIntoAttrs }:
1+{ stdenv, stackProject', recurseIntoAttrs, haskellLib }:
2
2
3with stdenv.lib;
3with stdenv.lib;
4
4
@@ -9,7 +9,9 @@ let
9 packages = project.hsPkgs;
9 packages = project.hsPkgs;
10
10
11in recurseIntoAttrs {
11in recurseIntoAttrs {
12+ ifdInputs = {
12− inherit (project) stack-nix;
13+ inherit (project) stack-nix;
14+ };
13 run = stdenv.mkDerivation {
15 run = stdenv.mkDerivation {
14 name = "callStackToNix-test";
16 name = "callStackToNix-test";
15
17
@@ -17,7 +19,7 @@ in recurseIntoAttrs {
17 exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe${stdenv.hostPlatform.extensions.executable}"
19 exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe${stdenv.hostPlatform.extensions.executable}"
18
20
19 printf "checking whether executable runs... " >& 2
21 printf "checking whether executable runs... " >& 2
20− cat ${packages.test-project-flags.components.exes.test-project-flags-exe.run}
22+ cat ${haskellLib.check packages.test-project-flags.components.exes.test-project-flags-exe}
21
23
22 touch $out
24 touch $out
23 '';
25 '';
test/setup-deps/default.nix+4−2
@@ -23,11 +23,13 @@ in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
23 touch $out
23 touch $out
24 '';
24 '';
25 in {
25 in {
26− plan-nix = skip;
26+ ifdInputs = { plan-nix = skip; };
27 run = skip;
27 run = skip;
28 }
28 }
29 else {
29 else {
30+ ifdInputs = {
30− inherit (project) plan-nix;
31+ inherit (project) plan-nix;
32+ };
31 run = pkgs.stdenv.mkDerivation {
33 run = pkgs.stdenv.mkDerivation {
32 name = "setup-deps-test";
34 name = "setup-deps-test";
33
35
test/shell-for-setup-deps/default.nix+4−2
@@ -22,12 +22,14 @@ in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
22 touch $out
22 touch $out
23 '';
23 '';
24 in {
24 in {
25− plan-nix = skip;
25+ ifdInputs = { plan-nix = skip; };
26 env = skip;
26 env = skip;
27 run = skip;
27 run = skip;
28 }
28 }
29 else {
29 else {
30+ ifdInputs = {
30− inherit (project) plan-nix;
31+ inherit (project) plan-nix;
32+ };
31 inherit env;
33 inherit env;
32 run = stdenv.mkDerivation {
34 run = stdenv.mkDerivation {
33 name = "shell-for-test";
35 name = "shell-for-test";
test/stack-simple/default.nix+4−3
@@ -1,4 +1,4 @@
1−{ stdenv, pkgs, mkStackPkgSet }:
1+{ stdenv, pkgs, mkStackPkgSet, haskellLib }:
2
2
3with stdenv.lib;
3with stdenv.lib;
4
4
@@ -14,9 +14,10 @@ let
14 packages = pkgSet.config.hsPkgs;
14 packages = pkgSet.config.hsPkgs;
15
15
16in pkgs.recurseIntoAttrs {
16in pkgs.recurseIntoAttrs {
17− stack-simple-exe = packages.stack-simple.components.exes.stack-simple-exe.run // {
17+ stack-simple-exe = (haskellLib.check packages.stack-simple.components.exes.stack-simple-exe) // {
18 # Attributes used for debugging with nix repl
18 # Attributes used for debugging with nix repl
19 inherit pkgSet packages;
19 inherit pkgSet packages;
20 };
20 };
21− stack-simple-test = packages.stack-simple.components.tests.stack-simple-test.run;
21+ stack-simple-test = packages.stack-simple.checks.stack-simple-test;
22+ stack-simple-checks = packages.stack-simple.checks;
22}
23}