Skip to content

Generate Hackage/LTS nix expressions on the fly rather than have them in the repo #16130

@obadz

Description

@obadz

@peti brought up an idea earlier on the IRC channel: if hackage-packages.nix is automatically generated, why does it need to be in the nix repo? Could we instead generate it as a nix derivation which would contain all versions of packages on hackage.

I hacked something together that's very crude, incomplete, and that needs a lot of work before it becomes even remotely serviceable but it illustrates the concept: https://gist.github.com/obadz/347fcf3ef0a86a9dbccbb7b04a80793b

You can inspect the generated nix expressions with:

$ nix-build ./autoHackage.nix -A autoHackageSrc

and you can see that at least one package builds by trying:

$ nix-build ./autoHackage.nix -A test-abstract-deque

Maybe we can move hackage-package.nix out of nixpkgs. We can probably do something similar for LTS releases (also @peti's idea).

Notes:

  1. There's a guard in there so that only packages with names starting in ab are generated. That's just to get rapid feedback while iterating.
  2. If you generate the full hackage package set, it's about 60MB of nix expressions uncompressed
  3. I used cabal2nix but I suspect there are more appropriate tools that I'm just not familiar with to do this
  4. If something like this became haskellPackages, we'd probably need to have enough packages in "static nix expressions" to build cabal2nix or any required tooling written in haskell

cc // @acowley @ttuegel @ocharles

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancementAdd something new or improve an existing system.6.topic: haskellGeneral-purpose, statically typed, purely functional programming language

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions