nixpkgs/pkgs/development/compilers/ghc/wrapper.nix
Andres Löh 2c096bf75f Fix the ghc-wrapper in order to enable runghc/runhaskell.
svn path=/nixpkgs/trunk/; revision=15774
2009-05-28 19:06:29 +00:00

32 lines
1.1 KiB
Nix

{stdenv, ghc, makeWrapper}:
stdenv.mkDerivation {
name = "ghc-${ghc.version}-wrapper";
buildInputs = [makeWrapper];
propagatedBuildInputs = [ghc];
unpackPhase = "true";
installPhase = ''
ensureDir $out/bin
cp $GHCGetPackages $out/bin/ghc-get-packages.sh
chmod 755 $out/bin/ghc-get-packages.sh
for prg in ghc ghci ghc-${ghc.version} ghci-${ghc.version}; do
makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\")"
done
for prg in runghc runhaskell; do
makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$($out/bin/ghc-get-packages.sh ${ghc.version} \"\$(dirname \$0)\" \" -package-conf --ghc-arg=\")"
done
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
ensureDir $out/nix-support
ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages
'';
GHCGetPackages = ./ghc-get-packages.sh;
inherit ghc;
ghcVersion = ghc.version;
}