diff options
author | Andres Löh <mail@andres-loeh.de> | 2011-12-03 16:19:43 +0000 |
---|---|---|
committer | Andres Löh <mail@andres-loeh.de> | 2011-12-03 16:19:43 +0000 |
commit | ecf037f2f7fa2aa956e582296cb06af093f3e4db (patch) | |
tree | f4d237fe483fc5fa2439991075e6209e8f3e19b9 /pkgs/development/compilers/ghc | |
parent | 72e5c8176e7a1ac2e9d2094ec21e90af225fe5bf (diff) | |
download | nixlib-ecf037f2f7fa2aa956e582296cb06af093f3e4db.tar nixlib-ecf037f2f7fa2aa956e582296cb06af093f3e4db.tar.gz nixlib-ecf037f2f7fa2aa956e582296cb06af093f3e4db.tar.bz2 nixlib-ecf037f2f7fa2aa956e582296cb06af093f3e4db.tar.lz nixlib-ecf037f2f7fa2aa956e582296cb06af093f3e4db.tar.xz nixlib-ecf037f2f7fa2aa956e582296cb06af093f3e4db.tar.zst nixlib-ecf037f2f7fa2aa956e582296cb06af093f3e4db.zip |
Added a wrapper function to produce a GHC with a predefined set of packages.
svn path=/nixpkgs/trunk/; revision=30716
Diffstat (limited to 'pkgs/development/compilers/ghc')
-rw-r--r-- | pkgs/development/compilers/ghc/with-packages.nix | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghc/with-packages.nix b/pkgs/development/compilers/ghc/with-packages.nix new file mode 100644 index 000000000000..2535e28ebc1f --- /dev/null +++ b/pkgs/development/compilers/ghc/with-packages.nix @@ -0,0 +1,67 @@ +{stdenv, ghcPlain, packages ? [], makeWrapper}: + +stdenv.mkDerivation rec { + name = "ghc-${ghcPlain.version}-linkdir"; + + allPackages = stdenv.lib.closePropagation packages; + buildInputs = allPackages ++ [makeWrapper]; + propagatedBuildInputs = packages; + + unpackPhase = "true"; + + installPhase = '' + originalTopDir="${ghcPlain}/lib/ghc-${ghcPlain.version}" + originalPkgDir="$originalTopDir/package.conf.d" + linkedTopDir="$out/lib" + linkedPkgDir="$linkedTopDir/package.conf.d" + + ensureDir $out/bin + cd $out/bin + + echo "Generating wrappers ..." + + for prg in ghc ghci ghc-${ghcPlain.version} ghci-${ghcPlain.version}; do + makeWrapper ${ghcPlain}/bin/$prg $out/bin/$prg --add-flags "-B$linkedTopDir" + done + + for prg in runghc runhaskell; do + makeWrapper ${ghcPlain}/bin/$prg $out/bin/$prg --add-flags "-f $out/bin/ghc" + done + + for prg in ghc-pkg ghc-pkg-${ghcPlain.version}; do + makeWrapper ${ghcPlain}/bin/$prg $out/bin/$prg --add-flags "--global-conf $linkedPkgDir" + done + + for prg in hp2ps hpc hasktags hsc2hs haddock haddock-${ghcPlain.version}; do + test -x ${ghcPlain}/bin/$prg && ln -s ${ghcPlain}/bin/$prg $out/bin/$prg + done + + ensureDir $linkedTopDir + cd $linkedTopDir + + if test -f $originalTopDir/settings; then + echo "Linking $originalTopDir/settings ..." + ln -s $originalTopDir/settings . + fi + + ensureDir $linkedPkgDir + cd $linkedPkgDir + + echo "Linking $originalPkgDir ..." + ln -s $originalPkgDir/*.conf . + + for currentPath in ${stdenv.lib.concatStringsSep " " allPackages}; do + currentPkgDir="$currentPath/lib/ghc-pkgs/ghc-${ghcPlain.version}" + if test -d $currentPkgDir; then + echo "Linking $currentPkgDir ..." + ln -s $currentPkgDir/*.conf . + fi + done + + echo "Generating package cache ..." + ${ghcPlain}/bin/ghc-pkg --global-conf $linkedPkgDir recache + + ''; + + # inherit ghc.meta; +} |