script for (automatized) installation of haskell executables with cabal using sandboxes
if you..
- want a basic set of cabal executables (such as hoogle, pandoc, hlint, ..), but do not use haskell platform
- do not want to clutter your global/user package databases, but use sandboxes instead
- do not want to learn/use nix (http://nixos.org/nix/) (i survived without it so far)
- linux
- tested on
- archlinux with only the ghc package installed
- debian: you have to manually install a more recent cabal-install because the default one in the official repos does not support sandboxes. Once it is installed, you can clear your user package-database again (if cabal-install put some garbage in there) and use this script to upgrade cabal-install in the future (with no cleaning necessary).
- sandboxes for everything (one sandbox per package).
- installs executables to $HOME/.cabal/bin (so add that to PATH, and be done)
- currently the sandbox directory is hardcoded to $HOME/.cabal/sandboxes/
- [optional] delete $HOME/.ghc and $HOME/.cabal
- add $HOME/.cabal/bin to PATH
- modify the MAIN section of this script to contain a "echo-install foo" line for each executable foo you want installed
- run the script
- wait an hour while everything installs
- [optional] enable "require-sandbox: True" in ~/.cabal/config to never accidentally install stuff user-globally
- result:
- each foo will be sandbox-installed in $HOME/.cabal/sandboxes/foo/
- the executables will be put in $HOME/.cabal/bin/
- the data directory for the executable will be $HOME/.cabal/share/foo/
- delete $HOME/.cabal/sandboxes
- delete the relevant executables
- delete this file :D
- one warning: the sandbox directory can easily grow to several GB of size. (there should be no problems deleting it once the executables are installed, though. but then you need to re-install everything for upgrades - not worth it imho)
- no error handling, really. if there are errors, you will have to manually fix them to get the relevant executables installed.
- ghc-7.10.3 still is the safest bet for installing executables (until all
major packages become compatible with ghc-8.0.*). If your system ships with
ghc-8.0, you can use a locally installed ghc-7.10.3 by passing the
--with-compiler=..
flag to this script; it will be forwarded to cabal.