Skip to content

Instantly share code, notes, and snippets.

@patrl
Created January 31, 2020 01:05
Show Gist options
  • Save patrl/a1bf407dd9d76210905bdc29346aa007 to your computer and use it in GitHub Desktop.
Save patrl/a1bf407dd9d76210905bdc29346aa007 to your computer and use it in GitHub Desktop.
Boilerplate for a nice haskell hacking experience, with nix, direnv, lorri, cabal new-*, and ghcide
eval "$(lorri direnv)"
cradle: {cabal: {}}
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc865" }:
let
inherit (nixpkgs) pkgs;
ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (ps: with ps; [
cabal-install
brittany
ghcid
]);
in
with pkgs;
runCommand "dummy" {
buildInputs = [
ghc
(import (builtins.fetchTarball "https://github.com/hercules-ci/ghcide-nix/tarball/master") {}).ghcide-ghc865
];
shellHook = ''
export NIX_GHC="${ghc}/bin/ghc"
export NIX_GHCPKG="${ghc}/bin/ghc-pkg"
export NIX_GHC_DOCDIR="${ghc}/share/doc/ghc/html"
export NIX_GHC_LIBDIR=$( $NIX_GHC --print-libdir )
'';
} ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment