Skip to content
Predictable Haskell development environments with Cabal and Nix.
Nix Shell
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.
nix/overrides/haskell megaparsec: init Mar 4, 2018
.gitignore Let there be, er, files Dec 22, 2017
LICENSE Let there be, er, files Dec 22, 2017 notes in readme Feb 1, 2018
rien.nix Let there be, er, files Dec 22, 2017 add ghc-mod script Feb 1, 2018
shell.template.nix Submoduley examples, README Jan 28, 2018

rien = predictable (haskell + cabal + nix)

  • create and work with Cabal-based Haskell development environments using Nix
  • use locally installed versions of development tools like ghc-mod etc

Eventually intended to be a good Stack replacement.

This is not even in alpha yet, and the only testing it gets is with GHC 8.2.2.

PRs and issues against other GHC versions are welcome!

Example: create a new project

# Create the directory and initialize a Git repo:
mkdir foo && cd foo && git init

# Add `rien` as a submodule to your Git repo:
git submodule add .rien/

# Create a nixpkgs lock-file:
nix-prefetch-git > nixpkgs.json

# Create a shell.nix and modify according to taste:
cp .rien/shell.template.nix shell.nix

# Enter a Nix shell with Cabal and ghc installed:

# Now we create a Cabal project and build it.
cabal init
cabal build

You can then run the application (if you built an executable):

$ cabal run foo
Hello, Haskell!


ghc-mod will be installed fine on GHC 8.2.2 if you just add ghc-mod to your deps list, but it will have trouble finding the path to the cabal-helper-wrapper executable, which it needs in order to work. To fix this, just source the included script as follows:

$ nix-shell
$ source .rien/

and you should be good to go.

Example setup

  rien = import .rien/rien.nix {
    packageName = "hello-world";
    packagePath = ./.;

    # Instead of using <nixpkgs>, use a lock-file to stick to
    # a particular `nixpkgs` commit.
    nixpkgsLock = ./nixpkgs.json;

    ghcVersion = "ghc822";

    overrides = {
      # I don't want to use Brittany as a library!
      justStaticExecutables = [ "brittany" ];

in {
    # Generate Hoogle documentation?
    wantHoogle = true;

    # Haskell dependencies
    deps = hsPkgs: with hsPkgs; [

    # Optionally, also add sets of related packages that are
    # commonly used together.
    depSets = hsPkgs: with (rien.package-sets hsPkgs); [

    # Native dependencies
    nativeDeps = pkgs: with pkgs; [


Lots of code is from haskell-nix and clash-playground.

You can’t perform that action at this time.