From e73e5c884f5770110d99675db8495bb1535a6308 Mon Sep 17 00:00:00 2001 From: Leon Isenberg Date: Thu, 20 Apr 2017 09:15:51 +0200 Subject: [PATCH] haskell: set LD_LIBRARY_PATH in shellHook LD_LIBRARY_PATH is considered by GHCI. Previously e.g. `cabal repl` failed on packages with system library dependencies. --- pkgs/development/haskell-modules/generic-builder.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index f7d16a89df8..f2b98e541e8 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -63,7 +63,8 @@ assert enableSplitObjs == null; let inherit (stdenv.lib) optional optionals optionalString versionOlder versionAtLeast - concatStringsSep enableFeature optionalAttrs toUpper; + concatStringsSep enableFeature optionalAttrs toUpper + filter makeLibraryPath; isGhcjs = ghc.isGhcjs or false; isHaLVM = ghc.isHaLVM or false; @@ -330,6 +331,9 @@ stdenv.mkDerivation ({ export NIX_${ghcCommandCaps}="${ghcEnv}/bin/${ghcCommand}" export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg" export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html" + export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:+''${LD_LIBRARY_PATH}:}${ + makeLibraryPath (filter (x: !isNull x) systemBuildInputs) + }" ${if isHaLVM then ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/HaLVM-${ghc.version}"'' else ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"''}