[Nix-dev] ghc / cabal and nix

Marc Weber marco-oweber at gmx.de
Sat Jun 2 05:05:39 CEST 2007


I think this would be sufficient to install a package (without
dependencies). I haven't tested it yet because I hesitate to insert this
code into the builder of each cabal package (there will be plenty).
I would strive for avoiding duplication. But where is the place to put
it?

=============  =======================================================
source $stdenv/setup

#add ghc to search path
test -n "$ghc" 
#ATH=$PATH:$ghc/bin

#unpack
tar xzf "$src"
cd cabal-*

#configure
ghc --make [Ss]etup.hs -o setup -package Cabal &&
./setup configure --prefix=$out

#make
./setup build &&

#install
./setup copy &&

# create package information 
./setup register --inplace  # (1)

$pkg_db=$out/package_db_containing_this_package
# create package database
echo '[]' >> $pkg_db (2)
export GHC_PACKAGE_PATH = $pkg_db (3a)
ghc-pkg update --auto-ghci-libs ./.inplace-pkg-config (3b)
=============  =======================================================

Changes (compared to  uulib*/default.nix):

* no longer using && .. && (because I think this can be done by using set -e, is this set automatically?)

* not setting $HOME to ../fake-home (because it should be set to /homeless-shelter anyway)

* (1) to write done a file containing package information (was contained in  register.sh)

* (2) create a this library only ghc-pkg database

* (3) registers the library using that database.

GHC_PACKAGE_PATH can be set to a : or ; separated list of package
databes files telling ghc where to find depenency packages.
(We must avoid a trailing delimiter because this would tell ghc-pkg to
also use the system global and user only package database)

Marc



More information about the nix-dev mailing list