Skip to content

Commit 9c1c92f

Browse files
committed
Merge remote-tracking branch 'origin/master' into hkm/ci-flake
2 parents 68b5f88 + 3a7f069 commit 9c1c92f

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

builder/comp-builder.nix

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,31 @@ let
461461
in ''
462462
runHook preInstall
463463
${ # `Setup copy` does not install tests and benchmarks.
464-
lib.optionalString (!haskellLib.isTest componentId && !haskellLib.isBenchmark componentId) ''
465-
$SETUP_HS copy ${lib.concatStringsSep " " (
466-
setupInstallFlags
467-
++ lib.optional configureAllComponents
468-
(haskellLib.componentTarget componentId)
469-
)}''}
464+
if !haskellLib.isTest componentId && !haskellLib.isBenchmark componentId
465+
then ''
466+
$SETUP_HS copy ${lib.concatStringsSep " " (
467+
setupInstallFlags
468+
++ lib.optional configureAllComponents
469+
(haskellLib.componentTarget componentId)
470+
)}''
471+
else
472+
# However if there are exes or libraries it does copy the datadir.
473+
# So run it, but expect it might complain there was nothing to do.
474+
''
475+
SETUP_ERR=$(mktemp)
476+
if $SETUP_HS copy ${lib.concatStringsSep " " (
477+
setupInstallFlags
478+
++ lib.optional configureAllComponents
479+
(haskellLib.componentTarget componentId)
480+
)} 2> >(tee $SETUP_ERR >&2); then
481+
echo Setup copy success
482+
else
483+
# we assume that if the SETUP_HS command fails and the following line was found in the error
484+
# log, that it was the only error. Hence if we do _not_ find the line, grep will fail and this derivation
485+
# will be marked as failure.
486+
cat $SETUP_ERR | grep 'Error: Setup: No executables and no library found\. Nothing to do\.'
487+
fi
488+
''}
470489
${lib.optionalString (haskellLib.isLibrary componentId) ''
471490
$SETUP_HS register --gen-pkg-config=${name}.conf
472491
${ghc.targetPrefix}ghc-pkg -v0 init $out/package.conf.d
@@ -519,6 +538,7 @@ let
519538
mkdir -p $out/bin
520539
if [ -f ${testExecutable} ]; then
521540
mkdir -p $(dirname $out/bin/${exeName})
541+
${lib.optionalString stdenv.buildPlatform.isLinux "sync"}
522542
${if stdenv.hostPlatform.isGhcjs then ''
523543
cat <(echo \#!${lib.getBin buildPackages.nodejs-18_x}/bin/node) ${testExecutable} >| $out/bin/${exeName}
524544
chmod +x $out/bin/${exeName}

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)