Set up Elm 0.15.1 on nixos

Ed:  elm is at 0.16, so I’ve put up a new guide, simpler than this one. 

Elm hasn’t made its way into nix-pkgs just yet, so building from source is still necessary.  The latest version is 0.15.1.  Last time I tried installing, it didn’t work out.  But today it was pretty straightforward with the right version of ghc.  I tried 7.8.4 but had some library conflicts.  With 7.10.2 installation was successful.

So to get going, first clone the git repo:

> cd <where I keep code>
> git clone
> git checkout 0.15.1

Then, make an shell.nix file that looks like this:

nixpkgs ? import  {}, compiler ? "ghc7102" }:
  inherit (nixpkgs) pkgs;
  cabal = pkgs.haskell.packages.${compiler}.cabal-install;
  ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (ps: with ps; [
          monad-par mtl
pkgs.stdenv.mkDerivation {
  name = "my-haskell-env-0";
  buildInputs = [ ghc cabal pkgs.zlib ];
  shellHook = "eval $(egrep ^export ${ghc}/bin/ghc)";

And put that shell.nix into the elm-platform directory.  Then,

[bburdette@nixosthe1:~/code/elm-platform]$ nix-shell
[nix-shell:~/code/elm-platform]$ runhaskell installers/BuildFromSource.hs 0.15.1

If all goes well, the executables end up here. This directory should be added to your path.

[nix-shell:~/code/elm-platform/Elm-Platform/0.15.1/.cabal-sandbox/bin]$ ls
aeson-pretty elm elm-make elm-package elm-reactor elm-repl glsl-pprint


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s