Video Tutorial: How to Fix Broken Haskell Packages in Nix

I created a brief video tutorial that shows how to fix a broken Haskell package build. I hope it might be useful to others. I’ll appreciate any constructive feedback, questions, or suggestions for other How-To videos to make. :slight_smile:

Here is the link:



This is really great! Also, I think you have a nice voice for narrating videos.

suggestions for other How-To videos to make

One thing I personally would really like to see is a video explaining how you update the haskell-updates branch. I imagine it involves running hackage2nix, but seeing you talk through all the steps would be really nice. Also, if GitHub - peti/ci: Continuous Integration with Hydra is involved in the process, hearing how that all works out would be really interesting.

Here’s some other ideas for things that I’ve had trouble with in the past, and I’ve seen other users ask about as well:

  • How to use callCabal2nix, callHackage, and callHackageDirect to easily build Haskell packages that may not be on Hackage. Maybe building local packages as well?
  • How to use shellFor to easily setup a development environment (additionally with tools like cabal and ghcid available).
  • The difference between configuration-common.nix, configuration-nix.nix, and configuration-ghc-*.*.x.nix and examples of when to put overrides in each.
  • The different ways of overriding/adding packages in the Haskell package sets. (packageOverrides vs overrides)
1 Like

I don’t know for python but lua and vim have scripts embedded in nixpkgs, which make it easy to regenerate the nix files, experiment a bit. the haskell ecosystem is huge with some specifities so I understand that we don’t necessarily want the whole infra in nixpkgs, but integrating this small script init maintainers/scripts/update-hackage by teto · Pull Request #62105 · NixOS/nixpkgs · GitHub would already allow to play a bit, unbreak some packages without having to clone an extra repo.

1 Like

Excellent work @peti. Only thing I’d add is a macro for {^_^} so we can point newbies at this thread when they ask about broken haskell packages on IRC.

<s>You forgot to ask people to like, comment and subscribe, and didn’t have a 25-second introduction before you started showing anything useful.</s>

1 Like

Awesome! I learned a lot. It would be good to have this as a blog post as well, so one could copy-paste the commands, and read at one’s own pace.

1 Like

Thank you very much for the extensive list of suggestions, @cdepillabout. I’ll need a while to get through that, but I’ll give it a shot. :slight_smile:


This was very informative indeed.

Another topic that might be worth covering is when a broken package can be fixed by providing one of its dependencies at a specific version.

For instance, at the moment there are two versions of haskell-lsp in nixpkgs, 0.15 and 0.18, but ghcide lacked an upper limit and required 0.17. So to unbreak ghcide I’d need to get the correct version of its dependencies first.

1 Like

Thank you very much this video. I don’t know if it’s the right place to ask but I’m trying to fix the servant-websockets package using the method presented in the video and I get the following error. Any idea ?

$ git checkout haskell-updates 
Already on 'haskell-updates'
Your branch is up to date with 'origin/haskell-updates'.

$ nix-build --no-out-link -A haskellPackages.arbtt

$ nix-build --no-out-link -A haskellPackages.servant
error: infinite recursion encountered, at undefined position
(use '--show-trace' to show detailed location information)

@juliendehos I believe haskellPackages.servant now builds correctly only the latest haskell-updates.

@cdepillabout Indeed. Thanks.

Maybe some instructions about how the haskell package set workflow and making changes to it works should be added to the nixpkgs manual?