Nix, Vim and Haskell

Posted on May 31, 2017

This is how I setup nix-shell environments vim and hakyll.

This is shelll.nix

{ pkgs ? import <nixpkgs> {} }:

let
  hs = pkgs.haskellPackages.ghcWithHoogle (self: with self; [
          hakyll
        ]);
in
pkgs.stdenv.mkDerivation {
  name = "haskell-shell";
  buildInputs = with pkgs.haskellPackages; [ hs cabal-install ghc-mod hlint hspec  ];

  shellHook = ''
    export PS1="\[\033[1;32m\][ns-hs:\w]\n$ \[\033[0m\]"
    eval "$(egrep ^export "$(type -p ghc)")"
  '';
}

I use cabal to do the build

$ cabal build
      
      title        Nix, Vim and Haskell    
      url            /posts/nix-vim-haskell/      
      path          posts/nix-vim-haskell.rst     
      date          May 31, 2017     
      author   
      metadata 
      missing  
      teaser   
      snippet