summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/dyre-nix.patch
blob: 458e540e0c4adc98d6d5c20415285877662c9d16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- dyre-0.8.12/Config/Dyre/Compile.hs	2015-04-13 11:00:20.794278350 +0100
+++ dyre-0.8.12-patched/Config/Dyre/Compile.hs	2015-04-13 11:07:26.938893502 +0100
@@ -10,11 +10,13 @@
 import System.FilePath   ( (</>) )
 import System.Directory  ( getCurrentDirectory, doesFileExist
                          , createDirectoryIfMissing )
+import System.Environment ( lookupEnv )
+import Control.Applicative ((<$>))
 import Control.Exception ( bracket )
-import GHC.Paths         ( ghc )
 
 import Config.Dyre.Paths  ( getPaths )
 import Config.Dyre.Params ( Params(..) )
+import Data.Maybe         ( fromMaybe )
 
 -- | Return the path to the error file.
 getErrorPath :: Params cfgType -> IO FilePath
@@ -47,6 +49,7 @@
     errFile <- getErrorPath params
     result <- bracket (openFile errFile WriteMode) hClose $ \errHandle -> do
         ghcOpts <- makeFlags params configFile tempBinary cacheDir libsDir
+        ghc <- fromMaybe "ghc" <$> lookupEnv "NIX_GHC"
         ghcProc <- runProcess ghc ghcOpts (Just cacheDir) Nothing
                               Nothing Nothing (Just errHandle)
         waitForProcess ghcProc