[Nix-dev] How to use wxHaskell? (example for building ghc packages)
Marc Weber
marco-oweber at gmx.de
Mon Apr 30 04:09:47 CEST 2007
> Can you point me to a Nix package that does this now? (I looked
> around but the only Haskell library I noticed in the package list was
> wxHaskell).
I'll try. I may still be completely wrong ;)
Have a look at trunk/pkgs/development/libraries/haskell/uulib-ghc-6.6/builder.sh:
============= =======================================================
source $stdenv/setup
tar xzf "$src" &&
cd uulib-* &&
autoconf &&
./configure --prefix=$out &&
ghc --make Setup.hs -o setup -package Cabal &&
./setup configure --prefix=$out --with-hc-pkg=ghc-pkg &&
./setup build &&
./setup install &&
./setup register --gen-script &&
mkdir -p $out/nix-support/ &&
cp register.sh $out/nix-support/register-ghclib.sh
============= =======================================================
here build install and register --gen-script is called.
The registers.sh script is then moved to $out/nix-support/register-ghclib.sh
The /trunk/pkgs/development/compilers/ghc-wrapper/builder.sh file sources them all
and creates some wrappers using this for loop:
for lib in $libraries; do
sh $lib/nix-support/register.sh $packages_db || exit 1
done
============= =======================================================
[..]
#create packages database (start with compiler base packages)
cp $ghc/lib/ghc-*/package.conf $packages_db
chmod +w $packages_db
for lib in $libraries; do
sh $lib/nix-support/register.sh $packages_db || exit 1
done
rm -f $packages_db.old
#create the wrappers
#NB: The double dash for ghc-pkg is not a typo!
makeWrapper $ghc "bin/ghc" "-package-conf" $packages_db
makeWrapper $ghc "bin/ghci" "-package-conf" $packages_db
makeWrapper $ghc "bin/runghc" "-package-conf" $packages_db
makeWrapper $ghc "bin/runhaskell" "-package-conf" $packages_db
makeWrapper $ghc "bin/ghc-pkg" "--global-conf" $packages_db
# todo: link all other binaries of ghc
============= =======================================================
That's all the magic.. You did ask for an example.. Have a look at
lhs2tex = import ../tools/typesetting/lhs2tex {
It does use packages distributed with ghc though..
Marc
More information about the nix-dev
mailing list