Skip to content

Commit ba5bc4e

Browse files
committed
Fix closure size issue
1 parent db3ca22 commit ba5bc4e

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

builder/comp-builder.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ let
411411
wrappedGhc=$ghc
412412
${configFiles.script}
413413
${shellWrappers.script}
414+
''
415+
# Remove any ghc docs pages so nixpkgs does not include them in $out
416+
# (this can result in unwanted dependencies on GHC)
417+
+ ''
418+
rm -rf $wrappedGhc/share/doc $wrappedGhc/share/man $wrappedGhc/share/devhelp/books
414419
PATH=$wrappedGhc/bin:$PATH
415420
416421
runHook preConfigure

builder/ghc-for-component-wrapper.nix

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ let
3434
# Start with a ghc and remove all of the package directories
3535
+ ''
3636
mkdir -p $wrappedGhc/bin
37-
${lndir}/bin/lndir -silent ${ghc} $wrappedGhc
37+
${lndir}/bin/lndir -silent $unwrappedGhc $wrappedGhc
3838
rm -rf ${libDir}/*/
3939
''
4040
# ... but retain the lib/ghc/bin directory. This contains `unlit' and friends.
4141
+ ''
42-
ln -s ${ghc}/lib/${ghcCommand}-${ghc.version}/bin ${libDir}
42+
ln -s $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/bin ${libDir}
4343
''
4444
# ... and the ghcjs shim's if they are available ...
4545
+ ''
46-
if [ -d ${ghc}/lib/${ghcCommand}-${ghc.version}/shims ]; then
47-
ln -s ${ghc}/lib/${ghcCommand}-${ghc.version}/shims ${libDir}
46+
if [ -d $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/shims ]; then
47+
ln -s $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/shims ${libDir}
4848
fi
4949
''
5050
# ... and node modules ...
5151
+ ''
52-
if [ -d ${ghc}/lib/${ghcCommand}-${ghc.version}/ghcjs-node ]; then
53-
ln -s ${ghc}/lib/${ghcCommand}-${ghc.version}/ghcjs-node ${libDir}
52+
if [ -d $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/ghcjs-node ]; then
53+
ln -s $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/ghcjs-node ${libDir}
5454
fi
5555
''
5656
# Replace the package database with the one from target package config.
@@ -69,9 +69,9 @@ let
6969
GHC_PLUGINS="["
7070
LIST_PREFIX=""
7171
${builtins.concatStringsSep "\n" (map (plugin: ''
72-
id=$(${ghc}/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} id --simple-output)
73-
lib_dir=$(${ghc}/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} dynamic-library-dirs --simple-output)
74-
lib_base=$(${ghc}/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} hs-libraries --simple-output)
72+
id=$($unwrappedGhc/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} id --simple-output)
73+
lib_dir=$($unwrappedGhc/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} dynamic-library-dirs --simple-output)
74+
lib_base=$($unwrappedGhc/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} hs-libraries --simple-output)
7575
lib="$(echo ''${lib_dir}/lib''${lib_base}*)"
7676
GHC_PLUGINS="''${GHC_PLUGINS}''${LIST_PREFIX}(\"''${lib}\",\"''${id}\",\"${plugin.moduleName}\",["
7777
LIST_PREFIX=""
@@ -95,9 +95,9 @@ let
9595
# The NIX_ variables are used by the patched Paths_ghc module.
9696
+ ''
9797
for prg in ${ghcCommand} ${ghcCommand}i ${ghcCommand}-${ghc.version} ${ghcCommand}i-${ghc.version}; do
98-
if [[ -x "${ghc}/bin/$prg" ]]; then
98+
if [[ -x "$unwrappedGhc/bin/$prg" ]]; then
9999
rm -f $wrappedGhc/bin/$prg
100-
makeWrapper ${ghc}/bin/$prg $wrappedGhc/bin/$prg \
100+
makeWrapper $unwrappedGhc/bin/$prg $wrappedGhc/bin/$prg \
101101
--add-flags '"-B$NIX_${ghcCommandCaps}_LIBDIR"' \
102102
--set "NIX_${ghcCommandCaps}" "$wrappedGhc/bin/${ghcCommand}" \
103103
--set "NIX_${ghcCommandCaps}PKG" "$wrappedGhc/bin/${ghcCommand}-pkg" \
@@ -108,9 +108,9 @@ let
108108
done
109109
110110
for prg in "${targetPrefix}runghc" "${targetPrefix}runhaskell"; do
111-
if [[ -x "${ghc}/bin/$prg" ]]; then
111+
if [[ -x "$unwrappedGhc/bin/$prg" ]]; then
112112
rm -f $wrappedGhc/bin/$prg
113-
makeWrapper ${ghc}/bin/$prg $wrappedGhc/bin/$prg \
113+
makeWrapper $unwrappedGhc/bin/$prg $wrappedGhc/bin/$prg \
114114
--add-flags "-f $wrappedGhc/bin/${ghcCommand}" \
115115
--set "NIX_${ghcCommandCaps}" "$wrappedGhc/bin/${ghcCommand}" \
116116
--set "NIX_${ghcCommandCaps}PKG" "$wrappedGhc/bin/${ghcCommand}-pkg" \
@@ -135,9 +135,9 @@ let
135135
# --global-package-db flag.
136136
+ ''
137137
for prg in ${ghcCommand}-pkg ${ghcCommand}-pkg-${ghc.version}; do
138-
if [[ -x "${ghc}/bin/$prg" ]]; then
138+
if [[ -x "$unwrappedGhc/bin/$prg" ]]; then
139139
rm -f $wrappedGhc/bin/$prg
140-
makeWrapper ${ghc}/bin/$prg $wrappedGhc/bin/$prg --add-flags "--global-package-db=$wrappedGhc/${packageCfgDir}"
140+
makeWrapper $unwrappedGhc/bin/$prg $wrappedGhc/bin/$prg --add-flags "--global-package-db=$wrappedGhc/${packageCfgDir}"
141141
fi
142142
done
143143

0 commit comments

Comments
 (0)