@@ -34,35 +34,43 @@ in runCommand "${ghc.name}-with-${package.identifier.name}" {
34
34
${ lndir } /bin/lndir -silent ${ ghc } $out
35
35
36
36
# ...and replace package database with the one from target package config.
37
- rm -rf ${ libDir }
38
- mkdir -p ${ libDir }
37
+ rm -rf ${ libDir } /*/
39
38
ln -s ${ configFiles } /package.conf.d ${ packageCfgDir }
40
39
41
40
# Wrap compiler executables with correct env variables.
42
41
# The NIX_ variables are used by the patched Paths_ghc module.
43
- # The GHC_ENVIRONMENT variable forces ghc to use the build
44
- # dependencies of the component.
45
42
46
- for prg in ${ ghcCommand } ${ ghcCommand } i ${ ghcCommand } -${ ghc . version } ${ ghcCommand } i-${ ghc . version } runghc runhaskell ; do
43
+ for prg in ${ ghcCommand } ${ ghcCommand } i ${ ghcCommand } -${ ghc . version } ${ ghcCommand } i-${ ghc . version } ; do
47
44
if [[ -x "${ ghc } /bin/$prg" ]]; then
48
45
rm -f $out/bin/$prg
49
46
makeWrapper ${ ghc } /bin/$prg $out/bin/$prg \
47
+ --add-flags '"-B$NIX_${ ghcCommandCaps } _LIBDIR"' \
50
48
--set "NIX_${ ghcCommandCaps } " "$out/bin/${ ghcCommand } " \
51
49
--set "NIX_${ ghcCommandCaps } PKG" "$out/bin/${ ghcCommand } -pkg" \
52
50
--set "NIX_${ ghcCommandCaps } _DOCDIR" "${ docDir } " \
53
- --set "NIX_${ ghcCommandCaps } _LIBDIR" "${ libDir } " \
54
- --set "${ ghcCommandCaps } _ENVIRONMENT" "${ configFiles } /ghc-environment"
51
+ --set "NIX_${ ghcCommandCaps } _LIBDIR" "${ libDir } "
52
+ fi
53
+ done
54
+
55
+ for prg in runghc runhaskell; do
56
+ if [[ -x "${ ghc } /bin/$prg" ]]; then
57
+ rm -f $out/bin/$prg
58
+ makeWrapper ${ ghc } /bin/$prg $out/bin/$prg \
59
+ --add-flags "-f $out/bin/${ ghcCommand } " \
60
+ --set "NIX_${ ghcCommandCaps } " "$out/bin/${ ghcCommand } " \
61
+ --set "NIX_${ ghcCommandCaps } PKG" "$out/bin/${ ghcCommand } -pkg" \
62
+ --set "NIX_${ ghcCommandCaps } _DOCDIR" "${ docDir } " \
63
+ --set "NIX_${ ghcCommandCaps } _LIBDIR" "${ libDir } "
55
64
fi
56
65
done
57
66
58
67
# Point ghc-pkg to the package database of the component using the
59
- # GHC_PACKAGE_PATH variable .
68
+ # --global-package-db flag .
60
69
61
70
for prg in ${ ghcCommand } -pkg ${ ghcCommand } -pkg-${ ghc . version } ; do
62
71
if [[ -x "${ ghc } /bin/$prg" ]]; then
63
72
rm -f $out/bin/$prg
64
- makeWrapper ${ ghc } /bin/$prg $out/bin/$prg \
65
- --set "${ ghcCommandCaps } _PACKAGE_PATH" "${ configFiles } /package.conf.d"
73
+ makeWrapper ${ ghc } /bin/$prg $out/bin/$prg --add-flags "--global-package-db=${ packageCfgDir } "
66
74
fi
67
75
done
68
76
0 commit comments