1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-15 09:03:48 +00:00
nixpkgs/pkgs/development/libraries/haskell/ghc-paths/ghc-paths-nix.patch

33 lines
1.1 KiB
Diff
Raw Normal View History

diff -Naur ghc-paths-0.1.0.9/GHC/Paths.hs ghc-paths-0.1.0.9-new/GHC/Paths.hs
--- ghc-paths-0.1.0.9/GHC/Paths.hs 2012-12-16 13:53:45.720148396 +0100
+++ ghc-paths-0.1.0.9-new/GHC/Paths.hs 2012-12-16 13:51:50.073070123 +0100
@@ -4,10 +4,24 @@
ghc, ghc_pkg, libdir, docdir
) where
+import Data.Maybe
+import System.Environment
+import System.IO.Unsafe
+
+nixLibdir, nixDocdir, nixGhc, nixGhcPkg :: Maybe FilePath
+nixLibdir = unsafePerformIO (lookupEnv "NIX_GHC_LIBDIR")
+nixDocdir = unsafePerformIO (lookupEnv "NIX_GHC_DOCDIR")
+nixGhc = unsafePerformIO (lookupEnv "NIX_GHC")
+nixGhcPkg = unsafePerformIO (lookupEnv "NIX_GHCPKG")
+{-# NOINLINE nixLibdir #-}
+{-# NOINLINE nixDocdir #-}
+{-# NOINLINE nixGhc #-}
+{-# NOINLINE nixGhcPkg #-}
+
libdir, docdir, ghc, ghc_pkg :: FilePath
-libdir = GHC_PATHS_LIBDIR
-docdir = GHC_PATHS_DOCDIR
+libdir = fromMaybe GHC_PATHS_LIBDIR nixLibdir
+docdir = fromMaybe GHC_PATHS_DOCDIR nixDocdir
-ghc = GHC_PATHS_GHC
-ghc_pkg = GHC_PATHS_GHC_PKG
+ghc = fromMaybe GHC_PATHS_GHC nixGhc
+ghc_pkg = fromMaybe GHC_PATHS_GHC_PKG nixGhcPkg