Skip to content
This repository

The new Hackage server aka "Hackage 2"

branch: master

Merge pull request #199 from hesselink/safari-auth-fix

Fix authentication in Safari.
latest commit 6d15b9d3a3
Duncan Coutts dcoutts authored
Octocat-spinner-32 Data Fix MemSize instance for modified IntTrie September 23, 2013
Octocat-spinner-32 Distribution Merge pull request #199 from hesselink/safari-auth-fix April 09, 2014
Octocat-spinner-32 datafiles Remove text about requesting upload right. February 02, 2014
Octocat-spinner-32 docs Tweak create-doc-builder-vm.txt August 16, 2012
Octocat-spinner-32 tests Split the server test suite into two, to avoid needing email by default November 18, 2013
Octocat-spinner-32 .authorspellings update authorspelling file August 03, 2010
Octocat-spinner-32 .gitignore Let git ignore the cabal sandbox September 27, 2013
Octocat-spinner-32 .travis.yml Only retry cabal test for the moment in travis config February 18, 2014
Octocat-spinner-32 BuildClient.hs Enable building of hoogle database December 01, 2013
Octocat-spinner-32 Dockerfile Add script to run both server and builder. September 14, 2013
Octocat-spinner-32 ImportClient.hs Set the http user agent in each client properly November 04, 2013
Octocat-spinner-32 LICENSE Update .cabal file July 21, 2008
Octocat-spinner-32 Main.hs Reload templates on SIGHUP April 07, 2014
Octocat-spinner-32 MirrorClient.hs Sanitise tarballs in mirror client February 16, 2014
Octocat-spinner-32 Various tweaks to the README April 07, 2014
Octocat-spinner-32 hackage-server.cabal Update HTTP to the latest version February 21, 2014
Octocat-spinner-32 Revert "Fix --force mode of build client" September 03, 2013
Octocat-spinner-32 Revert "Fix --force mode of build client" September 03, 2013
Octocat-spinner-32 Add script to run both server and builder. September 14, 2013
Octocat-spinner-32 Make executable August 20, 2013


Build Status

This is the hackage-server code. This is what powers, and many other private hackage instances.


cabal install

hackage-server init
hackage-server run

By default the server runs on port 8080 with the following settings:

URL:      http://localhost:8080/
username: admin
password: admin

To specify something different, see hackage-server init --help for details.

The server can be stopped by using Control-C.

This will save the current state and shutdown cleanly. Running again will resume with the same state.


To reset everything, kill the server and delete the server state:

rm -rf state/

Note that the datafiles/ and state/ directories differ: datafiles is for static html, templates and other files. The state directory holds the database (using acid-state and a separate blob store).

Creating users & uploading packages

Currently there is no restriction on registering, but only an admin user can grant privileges to registered users e.g. by adding them to other groups. In particular there are groups:

  • admins http://localhost:8080/users/admins/ -- administrators can do things with user accounts like disabling, deleting, changing other groups etc.
  • trustees http://localhost:8080/packages/trustees/ -- trustees can do janitorial work on all packages
  • mirrors http://localhost:8080/packages/mirrorers/ -- for special mirroring clients that are trusted to upload packages
  • per-package maintainer groups http://localhost:8080/package/foo/maintainers -- users allowed to upload packages
  • uploaders http://localhost:8080/packages/uploaders/ -- for uploading new packages


There is a program included in the hackage-server package called hackage-mirror. It's intended to enable syncing all the packages from one server to another, e.g. getting all the packages from the old hackage and uploading them to a local instance of a hackage-server.

To try it out:

  1. Add a user to the mirrorers group via http://localhost:8080/packages/mirrorers/
  2. Create a config file that contains the local and remote server. Assuming you are cloning the packages on locally, you could create a config file as follows:
echo -e "\nhttp://admin:admin@localhost:8080/" > servers.cfg
  1. Run the client, pointing to the config file:
hackage-mirror servers.cfg

This will do a one-time sync, and will bail out at the first sign of trouble. You can also do more robust and continuous mirroring. Use the flag --continuous. It will sync every 30 minutes (configurable with --interval). In this mode it carries on even when some packages cannot be mirrored for some reason and remembers them so it doesn't try them again and again. You can force it to try again by deleting the state files it mentions.

Something went wrong with that request. Please try again.