Page: [root]/howto/setup-hackage-mirror | src | log | faq | css

How to set up a hackage mirror

1. cd to a clean directory where you want your hackage mirror to be

2. Download package index:

wget http://hackage.haskell.org/packages/archive/00-index.tar.gz

3. This package index contains .cabal files of all packages that are available on hackage in /packages/archive/$package/$version/$package-$version.tar.gz. However, this is an exception for hackage.haskell.org, added and maintained by some moron. If your host is different, you have to serve them as /package/$package-$version.tar.gz. So, here's a shell script that downloads and places them for you:

for splitpk in `tar tf 00-index.tar.gz | cut -d/ -f 2,3`; do
	pk=`echo $splitpk | sed 's|/|-|'`
	name=$pk.tar.gz
	if [ ! -a package/$name ]; then
		wget http://hackage.haskell.org/packages/archive/$splitpk/$name -O package/$name
	fi
done

That is all! You can serve this directory as hackage mirror.

Here's a shell script that does it all for you: http://gist.github.com/562813

I also run a hackage mirror myself, with rsync support (see howto-rsync.txt).


Last edited: Voker57 on 2012-10-10 11:22:52 +0000