-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Description
@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 autoHackageSrcand you can see that at least one package builds by trying:
$ nix-build ./autoHackage.nix -A test-abstract-dequeMaybe we can move hackage-package.nix out of nixpkgs. We can probably do something similar for LTS releases (also @peti's idea).
Notes:
- There's a guard in there so that only packages with names starting in
abare generated. That's just to get rapid feedback while iterating. - If you generate the full hackage package set, it's about 60MB of nix expressions uncompressed
- I used
cabal2nixbut I suspect there are more appropriate tools that I'm just not familiar with to do this - If something like this became
haskellPackages, we'd probably need to have enough packages in "static nix expressions" to buildcabal2nixor any required tooling written in haskell