@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:
- 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.
- If you generate the full hackage package set, it's about 60MB of nix expressions uncompressed
- I used
cabal2nix but 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 build cabal2nix or any required tooling written in haskell
cc // @acowley @ttuegel @ocharles
@peti brought up an idea earlier on the IRC channel: if
hackage-packages.nixis 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:
and you can see that at least one package builds by trying:
Maybe we can move
hackage-package.nixout ofnixpkgs. We can probably do something similar for LTS releases (also @peti's idea).Notes:
abare generated. That's just to get rapid feedback while iterating.cabal2nixbut I suspect there are more appropriate tools that I'm just not familiar with to do thishaskellPackages, we'd probably need to have enough packages in "static nix expressions" to buildcabal2nixor any required tooling written in haskellcc // @acowley @ttuegel @ocharles