mirror of
https://github.com/haskell/ghcide.git
synced 2024-12-13 18:23:38 +03:00
Add: Support building in nix-shell. (#1670)
Can now run the demo script inside a nix-shell which provides a GHC libdir.
This commit is contained in:
parent
952959293f
commit
0058173e29
@ -31,8 +31,11 @@ import CmdLineParser
|
||||
import DynFlags
|
||||
import Panic
|
||||
import GHC
|
||||
import GHC.Paths
|
||||
import qualified GHC.Paths
|
||||
|
||||
-- Set the GHC libdir to the nix libdir if it's present.
|
||||
getLibdir :: IO FilePath
|
||||
getLibdir = fromMaybe GHC.Paths.libdir <$> lookupEnv "NIX_GHC_LIBDIR"
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
@ -78,7 +81,7 @@ showEvent lock e = withLock lock $ print e
|
||||
|
||||
-- | Create a GHC session that will be subsequently reused.
|
||||
newSession :: [String] -> IO HscEnv
|
||||
newSession flags = runGhc (Just libdir) $ do
|
||||
newSession flags = getLibdir >>= \libdir -> runGhc (Just libdir) $ do
|
||||
damlDFlags <- getSessionDynFlags
|
||||
(dflags', leftover, warns) <- parseDynamicFlagsCmdLine damlDFlags $ map noLoc flags
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user