@@ -1,27 +1,31 @@
1−{ stdenv, lib, haskellLib, srcOnly }:
1+{ stdenv, lib, haskellLib }:
5 component = drv.config;
5 component = drv.config;
12− # srcOnly returns just the subdir, so we're already in it.
15# This derivation can be used to execute test component.
7# This derivation can be used to execute test component.
16# The $out of the derivation is a file containing the resulting
8# The $out of the derivation is a file containing the resulting
17# stdout output.
9# stdout output.
18−in stdenv.mkDerivation ({
10+in stdenv.mkDerivation ((
15+ # This `cd` is normally done in the `prePatch` of the drv
16+ lib.optionalString (drv.srcSubDir != "") ''
17+ cd ${lib.removePrefix "/" drv.srcSubDir}
21+ # This makes the derivation work a bit like `srcOnly`,
22+ # using the original derivation, but replacing the `buildPhase`.
23+ (drv.drvAttrs or drv) // {
25+ separateDebugInfo = false;
19 name = (drv.name + "-check");
27 name = (drv.name + "-check");
21− # Using `srcOnly` (rather than getting the `src` via a `drv.passthru`)
22− # should correctly apply the patches from `drv` (if any).
23− src = drv.source or (srcOnly drv);
25 passthru = {
29 passthru = {
26 inherit (drv) identifier config configFiles executableToolDepends cleanSrc env exeName;
30 inherit (drv) identifier config configFiles executableToolDepends cleanSrc env exeName;
@@ -30,19 +34,12 @@ in stdenv.mkDerivation ({
31 inherit (component) doCheck doCrossCheck;
35 inherit (component) doCheck doCrossCheck;
33− phases = ["unpackPhase" "buildPhase"];
37+ phases = ["unpackPhase" "patchPhase" "buildPhase"];
35 # If doCheck or doCrossCheck are false we may still build this
39 # If doCheck or doCrossCheck are false we may still build this
36 # component and we want it to quietly succeed.
40 # component and we want it to quietly succeed.
37 buildPhase = ''
41 buildPhase = ''
38 mkdir $out
42 mkdir $out
40− # Change to the source sub directory if there is one.
41− lib.optionalString (subdir != "") ''
42− cd ${lib.removePrefix "/" subdir}
46 runHook preCheck
43 runHook preCheck
48 ${toString component.testWrapper} ${drv}/bin/${drv.exeName} ${lib.concatStringsSep " " component.testFlags} | tee $out/test-stdout
45 ${toString component.testWrapper} ${drv}/bin/${drv.exeName} ${lib.concatStringsSep " " component.testFlags} | tee $out/test-stdout