Skip to content
Nikola Plejić edited this page May 9, 2014 · 20 revisions

Idris on Debian jessie

[updated in feb' 2014 for idris 0.9.11.1 / ghc 7.6 from debian]

jessie is the codename of Debian's current testing release, and it is a good starting point to install Idris: Whereas wheezy, Debian's current stable release will get more and more outdated as time passes, jessie's packages are updated regularly and therefore more recent, usually only a few weeks behind sid (Debian's unstable release). This also makes Idris' installation easier, as e. g. llvm-3.3-dev, a requirement for Idris (cf. below) is already available on jessie. Being behind sid has the advantage nevertheless of avoiding the adventures and possible pitfalls of a bleeding edge release.

I will describe the installation of Idris in a virtual Haskell environment: hsenv, relying in great part on Debian packages.

Having installed a basic Hakell environment, and in particular cabal from Debian (your milage may vary, of course):

# apt-get install ghc
# apt-get install haskell-platform
# apt-get install cabal-install
# apt-get install libgmp-dev

(These commands can be shortened, as haskell-platform depends on ghc e. g.) I cabal install only one single package: hsenv system wide in my home dir i. e.

$ cabal update
$ cabal install hsenv

Further packages I install either from Debian or from within my isolated Haskell environment. Anyway, a few more Debian packages are needed:

# apt-get install llvm-3.3-dev
# apt-get install libghc-terminfo-dev
# apt-get install pkg-config
# apt-get install libgc-dev
# apt-get install build-essential
# apt-get install libghc-llvm-dev

A virtual env is created easily:

$ mkdir foo
$ cd foo
$ hsenv

Activate this environment with

$ source .hsenv/bin/activate

(as desribed in the output of issuing the command hsenv above, not shown here). This will give you an indication of your env being activated at the prompt:

[hsenv]$

By the way, as I use hsenv quite a lot, I have shortcuts for activating (a) and deactivating (d) defined in my .bashrc:

a()
{
    if [ -d "$(find . -maxdepth 1 -name ".hsenv")" ]; then
        echo "activating hsenv..."
        source ./.hsenv/bin/activate
    else
        echo "not a virtual hs env"
    fi
}


d()
{
    if [  -d "$(find . -maxdepth 1 -name ".hsenv")" ]; then
        echo "deactivating hsenv..."
        deactivate_hsenv
    else
        echo "not a virtual hs env"
    fi
}

This should be enough to install Idris:

[hsenv]$ cabal update
[hsenv]$ cabal install alex
[hsenv]$ cabal install idris

cabal-dev instead of hsenv should do just as well. Likewise cabal sandboxes, which I haven't tried yet however, as my Debian installed version of cabal (v 1.16.0) doesn't provide them yet.

If everything goes well, you should be able to just call idris from within your activated env

[hsenv]$ idris

The packages installed this way can be seen in .hsenv/cabal/lib. Many of those are available for Debian as well in recent enough versions, and the more I install from Debian, the less will cabal have to do, besides I will automatically get Debian updates etc. So, while not strictly necessary, I also install from Debian before cabal installing idris these packages (install each one e. g. with # apt-get install )

libghc-ansi-terminal-dev
libghc-ansi-wl-pprint-dev
libghc-blaze-builder-dev
libghc-blaze-html-dev
libghc-cereal-dev
libghc-cpphs-dev
libghc-data-default-class-dev
libghc-dlist-dev
libghc-exceptions-dev
libghc-fingertree-dev
libghc-free-dev
libghc-haskeline-dev
libghc-keys-dev
libghc-newtype-dev
libghc-pointed-dev
libghc-profunctors-dev
libghc-reducers-dev
libghc-reflection-dev
libghc-utf8-string-dev
libghc-void-dev
libghc-xml-dev

In this way the list of packages that ghc has to compile (are built by cabal) gets much shorter. It is a good idea to dry-run the cabal install command, before actually running it, i. e. run

[hsenv]$ cabal install --dry-run -v idris

then install a few of the packages above, (dry) run again, and see how the list of packages to be installed by cabal gets shorter. I. e. you might want to jump back and forth between dry running cabal install und apt-get installing a few packages, before actually installing idris.

Anyway, the list above is what I used in february 2014 / with ghc 7.6 You should be able to veryfy in a fresh hsenv, that indeed the list of cabal built packages gets shorter this way.

It should be pointed out though: some Debian Haskell packages installed this way, will just not be used, as Idris requires newer version than the ones provided by jessie, e. g.

# apt-get install libghc-aeson-dev
# apt-get install libghc-data-lens-dev

will just be ignorde in the Idris installation. But having them installed from Debian, doesn't hurt (impede) installation any more (as used to be the case for older versions of Idris/cabal)

Clone this wiki locally