@@ -63,7 +63,8 @@ assert enableSplitObjs == null;
6363let
6464
6565 inherit (stdenv.lib) optional optionals optionalString versionOlder versionAtLeast
66− concatStringsSep enableFeature optionalAttrs toUpper;
66+ concatStringsSep enableFeature optionalAttrs toUpper
67+ filter makeLibraryPath;
6768
6869 isGhcjs = ghc.isGhcjs or false;
6970 isHaLVM = ghc.isHaLVM or false;
@@ -330,6 +331,9 @@ stdenv.mkDerivation ({
330331 export NIX_${ghcCommandCaps}="${ghcEnv}/bin/${ghcCommand}"
331332 export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg"
332333 export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html"
334+ export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:+''${LD_LIBRARY_PATH}:}${
335+ makeLibraryPath (filter (x: !isNull x) systemBuildInputs)
336+ }"
333337 ${if isHaLVM
334338 then ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/HaLVM-${ghc.version}"''
335339 else ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"''}