utdemir / hs-nix-template

A Haskell project template that uses Nix and comes with cabal-install, ghcid, ormolu, haskell-language-server and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Prefer composable approach"

utdemir opened this issue · comments

There is an issue in haskell-nix repo suggesting a few good practices, and they all make sense to me. I think we should apply them to our template too.

To quote:

The examples use methods that cause issues when trying to extend the package set further. Using the right tools, which are no harder, we can avoid frustration down the line.

  • Use overlays instead of overrides. They are the way to go, because they are more powerful and, I'd argue, more consistent: overlays for packages sets, overrides for packages.
  • Avoid rec keyword. People get used to it and will use it in overlay definitions, leading to surprises.
  • Use haskellPackages.extend instead of .override { overrides =. It lets you add more layers of overrides which is more flexible. Attempting the same on the current code replaces the single layer of overrides with the new one, which is unexpected. As a bonus, it is syntactically simpler.

I think the first and third point is relevant to us.

Looks like there're still some issues around using overlays for Haskell packages (NixOS/nixpkgs#26561), so I'll postpone this for a while.