How to regenerate hackage-packages.nix?

I have a fix for a broken Haskell packages. To complete it, I need to regenerate hackage-packages.nix. How is this done?

I’ve seen @peti’s video tutorial, but don’t see it there. The various web pages for hackage2nix seem to explain how to update that file, rather than regenerate from a few minor fixes.

Help would be much appreciated!

Regards,
Mike

hackage-packages.nix is updated automatically about once a day or so.

We almost never update it by hand in the normal course of development.

You can see the automatic updates on PRs like the following:

I’m not following: I don’t want to update, I merely want to reflect a fix I made in configuration-hackage2nix.yaml. I need this to test the change I made in configuration-common.nix, which depends on an up-to-date hackage-packaqes.nix.

I had the same need as you hence this PR that I believe make the process more discoverable https://github.com/NixOS/nixpkgs/pull/62105

Ah, I think I understand what you’re saying.

You want a way to regenerate it, using the same state of Hackage, so that the only changes are the things you’ve added/removed in configuration-hackage.yaml?

However, you don’t want to use the directions from https://www.youtube.com/watch?v=qX0mgtSm360 to update it, because then you get a bunch of unrelated package updates from Hackage?

I’m not sure if there is a way to easily regenerate it based on the old state of Hackage.

I’d suggest looking through the hackage2nix source code to see if you can find any command line arguments that may be relevant:

Or maybe the script from teto’s PR helps?


Another possibility is to split your PR into two:

  1. A PR that adds changes in configuration-hackage2nix.yaml
  2. A PR that adds fixes to configuration-common.nix

We could go ahead add merge in (1), wait a day for hackage-packages.nix to be updated, and then rebase (2) on top of it.

This is slightly more work, but then you don’t have to worry about regenerating hackage-packages.nix locally.

Yes, your take is exactly right in every way, thanks!

(And I agree with @teto - it would be great if this were a) easier and b) prominently documented, to make it easier to contribute.)

And I’ll try your suggestion of splitting the PR - great idea!

I need to regenerate hackage-packages.nix . How is this done?

1 Like