Skip to content
Automatic Haskell setup in Emacs, for Nix users
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml Init nix-haskell-mode.el Mar 29, 2019
LICENSE Create LICENSE Mar 29, 2019
Makefile Init nix-haskell-mode.el Mar 29, 2019
default.nix v0.0.3 Apr 15, 2019
nix-haskell-mode.el Fixup nix-haskell-message Jun 15, 2019


nix-haskell-mode is an easy way to get Haskell projects set up in Emacs. It uses haskell-mode’s interactive-haskell-mode to provide integration with Emacs. Nix is used to pull in dependencies of each Cabal file.

To use with use-package, just add this to your configuration,

(use-package nix-haskell-mode
  :hook (haskell-mode . nix-haskell-mode))

nix-haskell-mode is available in MELPA. You can install it yourself with M-x package-install nix-haskell-mode. Alternative configuration for vanilla Emacs is available below,

(require 'haskell-mode)
(require 'nix-haskell-mode)
(add-hook 'haskell-mode-hook 'nix-haskell-mode)

This configuration should work out of the box with Cabal projects. If you have custom dependencies that need to be available, you should create override in Haskell packages in Nix. More documentation on this is available in the Nixpkgs manual available here:

Affected modes

These modes are affected by nix-haskell-mode. They are listed below along with what variables are set by nix-haskell-mode.

  • Flycheck - sets flycheck-ghc-package-databases and flycheck-haskell-ghc-executable.
  • Haskell Mode - sets haskell-process-type to cabal-new-repl, haskell-process-path-cabal, haskell-process-args-cabal-new-repl.

Project information

This project is available at Pull requests and issues are accepted.

Disabling nix-haskell-mode for a project

Occasionally you will want to disable nix-haskell-mode. This might occur in very large projects where interactive-haskell-mode fails at or when some dependency cannot be fetched succesfully. In these cases, you should run the following in the root of your project:

=M-x add-dir-local-variable<RET>haskell-mode<RET>eval<RET>(nix-haskell-mode -1)<RET>=

You can’t perform that action at this time.