ghc.withPackages: Wrap hls with package lookup env

This commit is contained in:
Malte Brandy 2020-07-14 22:20:07 +02:00 committed by Peter Simons
parent 5e756f5f31
commit ac8c823955

View File

@ -105,14 +105,16 @@ symlinkJoin {
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}" --set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"
fi fi
# ghcide does package discovery without calling our ghc wrapper. # ghcide and haskell-language-server do package discovery without calling our ghc wrapper.
if [[ -x "$out/bin/ghcide" ]]; then for prg in ghcide haskell-language-server; do
wrapProgram $out/bin/ghcide \ if [[ -x "$out/bin/$prg" ]]; then
wrapProgram $out/bin/$prg \
--set "NIX_${ghcCommandCaps}" "$out/bin/${ghcCommand}" \ --set "NIX_${ghcCommandCaps}" "$out/bin/${ghcCommand}" \
--set "NIX_${ghcCommandCaps}PKG" "$out/bin/${ghcCommand}-pkg" \ --set "NIX_${ghcCommandCaps}PKG" "$out/bin/${ghcCommand}-pkg" \
--set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \ --set "NIX_${ghcCommandCaps}_DOCDIR" "${docDir}" \
--set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}" --set "NIX_${ghcCommandCaps}_LIBDIR" "${libDir}"
fi fi
done
'' + (lib.optionalString (stdenv.targetPlatform.isDarwin && !isGhcjs && !stdenv.targetPlatform.isiOS) '' '' + (lib.optionalString (stdenv.targetPlatform.isDarwin && !isGhcjs && !stdenv.targetPlatform.isiOS) ''
# Work around a linker limit in macOS Sierra (see generic-builder.nix): # Work around a linker limit in macOS Sierra (see generic-builder.nix):