haskellPackages.mueval: fix evaluation

This commit is contained in:
Nikolay Amiantov 2015-04-16 13:01:13 +03:00
parent d56e9b4f05
commit 8d91cc7637
3 changed files with 53 additions and 0 deletions

View File

@ -754,6 +754,14 @@ self: super: {
# Patch to consider NIX_GHC just like xmonad does
dyre = appendPatch super.dyre ./dyre-nix.patch;
# Fix problems with GHC >=7.8 (in compatible way)
mueval = let pkg = appendPatch super.mueval (pkgs.fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/gwern/mueval/pull/4.patch";
sha256 = "1l0jn2lbzbhx9ifbpb5g617qa0fc8fwa6kyr87pjqfxpqminsgp5";
});
# Nix-specific workaround
in appendPatch pkg ./mueval-nix.patch;
} // {
# Not on Hackage.

View File

@ -0,0 +1,22 @@
diff -ru3 lambdabot-5.0.1.old/State/L.hs lambdabot-5.0.1/State/L.hs
--- lambdabot-5.0.1.old/State/L.hs 2015-04-15 03:26:04.818947594 +0300
+++ lambdabot-5.0.1/State/L.hs 2015-04-15 03:26:20.386099365 +0300
@@ -34,7 +34,6 @@
import Control.Monad
import Control.Monad.Cont
import Control.Monad.Identity
-import Control.Monad.Instances
import Control.Monad.Reader
import Control.Monad.ST.Safe
import Control.Monad.State
diff -ru3 lambdabot-5.0.1.old/State/Pristine.hs lambdabot-5.0.1/State/Pristine.hs
--- lambdabot-5.0.1.old/State/Pristine.hs 2015-04-15 03:26:04.818947594 +0300
+++ lambdabot-5.0.1/State/Pristine.hs 2015-04-15 03:26:20.386099365 +0300
@@ -34,7 +34,6 @@
import Control.Monad
import Control.Monad.Cont
import Control.Monad.Identity
-import Control.Monad.Instances
import Control.Monad.Reader
import Control.Monad.ST.Safe
import Control.Monad.State

View File

@ -0,0 +1,23 @@
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 ->