about summary refs log tree commit diff
path: root/pkgs/development/compilers/ghc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2009-04-18 15:23:00 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2009-04-18 15:23:00 +0000
commitbaad5d7cb4ee715fe0743a6b160096f1515641fe (patch)
treed4c3267deddd4bb8fcde259412fd021de29d9607 /pkgs/development/compilers/ghc
parent9c509e25835fb29cb29c72ef1bea7722c96c07fa (diff)
downloadnixlib-baad5d7cb4ee715fe0743a6b160096f1515641fe.tar
nixlib-baad5d7cb4ee715fe0743a6b160096f1515641fe.tar.gz
nixlib-baad5d7cb4ee715fe0743a6b160096f1515641fe.tar.bz2
nixlib-baad5d7cb4ee715fe0743a6b160096f1515641fe.tar.lz
nixlib-baad5d7cb4ee715fe0743a6b160096f1515641fe.tar.xz
nixlib-baad5d7cb4ee715fe0743a6b160096f1515641fe.tar.zst
nixlib-baad5d7cb4ee715fe0743a6b160096f1515641fe.zip
* GHC setup hook: don't generate wrappers around ghc etc., instead
  set GHC_PACKAGE_PATH.
* Let Cabal generate a package configuration file
  ($out/nix-support/ghc-package.conf) instead of a registration
  script.

svn path=/nixpkgs/trunk/; revision=15127
Diffstat (limited to 'pkgs/development/compilers/ghc')
-rw-r--r--pkgs/development/compilers/ghc/setup-hook.sh39
1 files changed, 7 insertions, 32 deletions
diff --git a/pkgs/development/compilers/ghc/setup-hook.sh b/pkgs/development/compilers/ghc/setup-hook.sh
index a73ddada0263..dc7066f31b67 100644
--- a/pkgs/development/compilers/ghc/setup-hook.sh
+++ b/pkgs/development/compilers/ghc/setup-hook.sh
@@ -1,40 +1,15 @@
-# Support dir for isolating GHC
-ghc_support=$TMPDIR/ghc-6.8-nix-support
-ensureDir $ghc_support
-
 # Create isolated package config
-packages_db=$ghc_support/package.conf
+packages_db=$TMPDIR/.package.conf
 cp @ghc@/lib/ghc-*/package.conf $packages_db
-chmod +w $packages_db
-
-# Generate wrappers for GHC that use the isolated package config
-makeWrapper() {
-  wrapperName="$1"
-  wrapper="$ghc_support/$wrapperName"
-  shift #the other arguments are passed to the source app
-  echo '#!'"$SHELL" > "$wrapper"
-  echo "exec \"@ghc@/bin/$wrapperName\" $@" '"$@"' >> "$wrapper"
-  chmod +x "$wrapper"
-}
-
-makeWrapper "ghc"         "-no-user-package-conf -package-conf $packages_db"
-makeWrapper "ghci"        "-no-user-package-conf -package-conf $packages_db"
-makeWrapper "runghc"      "-no-user-package-conf -package-conf $packages_db"
-makeWrapper "runhaskell"  "-no-user-package-conf -package-conf $packages_db"
-makeWrapper "ghc-pkg"     "--global-conf $packages_db"
+chmod u+w $packages_db
 
-# Add wrappers to search path
-export _PATH=$ghc_support:$_PATH
+export GHC_PACKAGE_PATH=$packages_db
 
 # Env hook to add packages to the package config
-addLibToPackageConf ()
-{
-    local regscript=$1/nix-support/register-ghclib.sh
-    if test -f $regscript; then
-        local oldpath=$PATH
-        export PATH=$ghc_support:$PATH
-        sh $regscript $package_db
-        export PATH=$oldpath
+addLibToPackageConf () {
+    local confFile=$1/nix-support/ghc-package.conf
+    if test -f $confFile; then
+        @ghc@/bin/ghc-pkg register $confFile
     fi
 }