Skip to content

Commit 2bc0588

Browse files
committed
Fix for ghcjs
1 parent 17c0392 commit 2bc0588

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

overlays/ghcjs.nix

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,35 @@ final: prev:
2424
shift
2525
${final.buildPackages.nodejs-12_x}/bin/node $exe $@
2626
'') + "/bin/node-wrapper")];
27-
packages.unix.components.library.preConfigure = ''
28-
cp ${./patches/config.sub} config.sub
29-
cp ${./patches/config.guess} config.guess
30-
chmod +w config.*
31-
'';
27+
28+
# Apply the patches that came with `ghcjs`
29+
# Also add a "Keep alive" message to prevent hydra timeouts when hsc2hs runs
30+
packages = pkgs.lib.genAttrs ["base" "directory" "filepath" "ghc-prim" "integer-gmp" "process" "template-haskell" "time" "unix" "Win32" ]
31+
(name: {
32+
components.library.preConfigure = ''
33+
tr -d '\r' < ${name}.cabal > ${name}.cabal-new
34+
mv ${name}.cabal-new ${name}.cabal
35+
patch -p3 < ${pkgs.buildPackages.haskell-nix.compiler.${config.compiler.nix-name}.project.configured-src}/lib/patches/${name}.patch
36+
'';
37+
components.library.preBuild = ''
38+
# Avoid timeouts while unix package runs hsc2hs (it does not print anything
39+
# for more than 900 seconds).
40+
KEEP_ALIVE_TMP=$(mktemp -d)
41+
(
42+
for n in {1..300}; do
43+
if [ ! -f $KEEP_ALIVE_TMP/done ]; then
44+
sleep 10
45+
if (( $n % 30 == 0 )); then
46+
echo "Keep alive: ${name} package build has been running for $(( n / 6 )) minute(s)"
47+
fi
48+
fi
49+
done
50+
) &
51+
'';
52+
components.library.postBuild = ''
53+
echo ok > $KEEP_ALIVE_TMP/done
54+
'';
55+
});
3256
})
3357
);
3458
});

0 commit comments

Comments
 (0)