@@ -15,6 +15,8 @@
15, preBuild ? null, postBuild ? null
15, preBuild ? null, postBuild ? null
16, preCheck ? null, postCheck ? null
16, preCheck ? null, postCheck ? null
17, preInstall ? null, postInstall ? null
17, preInstall ? null, postInstall ? null
19+, doCheck ? componentId.ctype == "test"
@@ -127,9 +129,7 @@ let
127in stdenv.mkDerivation ({
129in stdenv.mkDerivation ({
128 name = fullName;
130 name = fullName;
130− inherit src;
132+ inherit src doCheck;
132− doCheck = componentId.ctype == "test";
134 passthru = {
134 passthru = {
135 inherit (package) identifier;
135 inherit (package) identifier;
@@ -181,30 +181,31 @@ in stdenv.mkDerivation ({
181 runHook postBuild
181 runHook postBuild
184− # Note: Cabal does *not* copy test executables during the `install` phase.
185− # Thus we'll just copy them during the check phase.
186 checkPhase = ''
184 checkPhase = ''
187 runHook preCheck
185 runHook preCheck
188− $SETUP_HS test
186+ $SETUP_HS test ${lib.concatStringsSep " " component.setupTestFlags}
189− mkdir -p $out/${name}
190 cp dist/test/*.log $out/${name}/
187 cp dist/test/*.log $out/${name}/
191− if [ -f "dist/build/${componentId.cname}/${componentId.cname}" ]; then
192− cp dist/build/${componentId.cname}/${componentId.cname} $out/${name}/
194− if [ -f "dist/build/${componentId.cname}/${componentId.cname}.exe" ]; then
195− cp dist/build/${componentId.cname}/${componentId.cname}.exe $out/${name}/
197 runHook postCheck
188 runHook postCheck
191+ # Note: Cabal does *not* copy test executables during the `install` phase.
200 installPhase = ''
192 installPhase = ''
201 runHook preInstall
193 runHook preInstall
202− $SETUP_HS copy
194+ $SETUP_HS copy ${lib.concatStringsSep " " component.setupInstallFlags}
203 ${lib.optionalString (haskellLib.isLibrary componentId) ''
195 ${lib.optionalString (haskellLib.isLibrary componentId) ''
204 $SETUP_HS register --gen-pkg-config=${name}.conf
196 $SETUP_HS register --gen-pkg-config=${name}.conf
205 ${ghc.targetPrefix}ghc-pkg init $out/package.conf.d
197 ${ghc.targetPrefix}ghc-pkg init $out/package.conf.d
206 ${ghc.targetPrefix}ghc-pkg --package-db ${configFiles}/package.conf.d -f $out/package.conf.d register ${name}.conf
198 ${ghc.targetPrefix}ghc-pkg --package-db ${configFiles}/package.conf.d -f $out/package.conf.d register ${name}.conf
200+ ${lib.optionalString (componentId.ctype == "test") ''
201+ mkdir -p $out/${name}
202+ if [ -f "dist/build/${componentId.cname}/${componentId.cname}" ]; then
203+ cp dist/build/${componentId.cname}/${componentId.cname} $out/${name}/
205+ if [ -f "dist/build/${componentId.cname}/${componentId.cname}.exe" ]; then
206+ cp dist/build/${componentId.cname}/${componentId.cname}.exe $out/${name}/
208 runHook postInstall
209 runHook postInstall