Nix Notes: Overriding Haskell Packages

Setup

In one of the projects, I use a pinned version of nixpkgs based on miso. There are two advantages to that, one is that I know that miso builds with that version, and the second one is that I can take advantage of miso’s cachix cache and not compile everything from scratch.

In the most basic form, it looks like this.

File nixpkgs.nix:

let

  bootstrap = import <nixpkgs> {};

  misoTarball = bootstrap.fetchFromGitHub {
    owner = "dmjio";
    repo = "miso";
    rev = "2c193a3253216d70f0ac182fbe9c801de00363ae";
    sha256 = "1ywksdzcfd339x1hxp5pvkgbv9mdy1y0971k8v161hg33na2p8wz";
  };

  miso = import "${misoTarball}" { } ;

  inherit (miso) pkgs;

in miso.pkgs

I can then use it in another file to compile my local Haskell package named automation-server.

Read more...