summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2009-07-27 16:05:44 +0000
committerMarc Weber <marco-oweber@gmx.de>2009-07-27 16:05:44 +0000
commit58239ae82a683ada1d39c0225bab555a7bfce6cd (patch)
treeef83246d6fd7530fc7088edcf9a5099a37a9f2b8 /pkgs/development
parentada954cfbc9695484f381f9282654627707833ab (diff)
downloadnixlib-58239ae82a683ada1d39c0225bab555a7bfce6cd.tar
nixlib-58239ae82a683ada1d39c0225bab555a7bfce6cd.tar.gz
nixlib-58239ae82a683ada1d39c0225bab555a7bfce6cd.tar.bz2
nixlib-58239ae82a683ada1d39c0225bab555a7bfce6cd.tar.lz
nixlib-58239ae82a683ada1d39c0225bab555a7bfce6cd.tar.xz
nixlib-58239ae82a683ada1d39c0225bab555a7bfce6cd.tar.zst
nixlib-58239ae82a683ada1d39c0225bab555a7bfce6cd.zip
ghc: add ghc-packages returning list of package databases so that you
can define GHC_PACKAGE_PATH=`ghc-packgaes` easily. Required for scion

svn path=/nixpkgs/trunk/; revision=16481
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/ghc/wrapper.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghc/wrapper.nix b/pkgs/development/compilers/ghc/wrapper.nix
index 7d37cba6efed..c3c9ce2d3eac 100644
--- a/pkgs/development/compilers/ghc/wrapper.nix
+++ b/pkgs/development/compilers/ghc/wrapper.nix
@@ -20,6 +20,24 @@ stdenv.mkDerivation {
     for prg in ghc-pkg ghc-pkg-${ghc.version}; do
       makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\" --package-conf=)"
     done
+    cat >> $out/bin/ghc-packages << EOF
+    #! /bin/bash -e
+    declare -A GHC_PACKAGES_HASH # using bash4 hashs to get uniq paths
+
+    for arg in \$($out/bin/ghc-get-packages.sh 6.10.3 "$(dirname $0)"); do
+      case "\$arg" in
+        -package-conf) ;;
+        *)
+          CANONICALIZED="\$(readlink -f "\$arg")"
+          GHC_PACKAGES_HASH["\$CANONICALIZED"]= ;;
+      esac
+    done
+
+    for path in \''${!GHC_PACKAGES_HASH[@]}; do
+      echo -n "\$path:"
+    done
+    EOF
+    chmod +x $out/bin/ghc-packages
     ensureDir $out/nix-support
     ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
   '';