cee387e845
into haskell-packages.nix, which depends on an instance of GHC. This allows a consistent set of packages to be built with the same GHC. For instance, $ nix-build -A haskellPackages_ghc683.xmonad builds xmonad and all its dependencies with GHC 6.8.3, while $ nix-build -A haskellPackages_ghc6102.xmonad does the same with GHC 6.10.2. This is the same technique used with kernelPackages. It also means that we don't need things like "cabal682" and "cabal683" anymore. * The setup hook is now in a separate wrapper package so that we don't have to recompile all of GHC every time we want to make a small change. * cinelerra: this package appears to have an accidental dependency on the "X11" Haskell package. svn path=/nixpkgs/trunk/; revision=15125
42 lines
1.3 KiB
Bash
42 lines
1.3 KiB
Bash
# 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
|
|
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"
|
|
|
|
# Add wrappers to search path
|
|
export _PATH=$ghc_support:$_PATH
|
|
|
|
# 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
|
|
fi
|
|
}
|
|
|
|
envHooks=(${envHooks[@]} addLibToPackageConf)
|