Using Haskell packages built from GitHub - Nix

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Magnus Therning

The other day I needed to use a version of a package that isn't released on Hackage yet. After a bit of googling I came up with the following:

First run

cabal2nix --no-haddock --no-check --subpath core git:// > amazonka-core.nix

to get an expression to build the package.

Then create a "new haskellPackages" overriding amazonka-core:

hp = haskellPackages.override {
  overrides = self: super: {
    amazonka-core = self.callPackage ./amazonka-core.nix {};

Finally, use hp.developPackage for the local source.

I rather like it, but I'm curious if that's how others would do it, or is there some better way?

Torsten Schmits

you can do this a bit simpler:

amazonka-core = self.callCabal2nix "amazonka-core" (fetch{Tarball,Git,...} https://...) {};

this can benefit a lot from using niv, in which case you just write niv.amazonka-core for the fetch part and update the ref with the cli tool!