nixpkgs/pkgs/development/haskell-modules/mueval-nix.patch
2015-04-16 13:32:48 +03:00

23 lines
1.4 KiB
Diff

diff --git a/Mueval/Interpreter.hs b/Mueval/Interpreter.hs
index 29b771f..6360ee3 100644
--- a/Mueval/Interpreter.hs
+++ b/Mueval/Interpreter.hs
@@ -8,6 +8,7 @@ import Control.Monad.Writer (Any(..),runWriterT,tell)
import Data.Char (isDigit)
import Data.List (stripPrefix)
import System.Directory (copyFile, makeRelativeToCurrentDirectory, removeFile, setCurrentDirectory)
+import System.Environment (lookupEnv)
import System.Exit (exitFailure)
import System.FilePath.Posix (takeFileName)
import qualified Control.Exception.Extensible as E (evaluate,catch,SomeException(..))
@@ -47,6 +48,10 @@ interpreter Options { extensions = exts, namedExtensions = nexts,
-- Explicitly adding ImplicitPrelude because of
-- http://darcsden.com/jcpetruzza/hint/issue/1
unless (null lexts) $ set [languageExtensions := (UnknownExtension "ImplicitPrelude" : lexts)]
+ pkgs' <- liftIO $ lookupEnv "NIX_GHC_LIBDIR"
+ case pkgs' of
+ Just pkgs -> unsafeSetGhcOption ("-package-db " ++ pkgs ++ "/package.conf.d")
+ Nothing -> return ()
when trust $ do
unsafeSetGhcOption "-fpackage-trust"
forM_ (trustPkgs >>= words) $ \pkg ->