Add haskell.lib.incremental utility#203499
Add haskell.lib.incremental utility#203499Gabriella439 wants to merge 90 commits intoNixOS:masterfrom
haskell.lib.incremental utility#203499Conversation
|
Needless to say, this should not be merged until NixOS/nix#7362 is merged, but I'm putting up this PR for review anyway since it informs the upstream PR to Nix |
There was a problem hiding this comment.
Please remove this function from the PR. If I understand it correctly, it depends on NixOS/nix#7362 – “presuming it is merged” is presumed too much. In general I also want to keep anything out of haskell.lib that depends on unreleased Nix features.
Presumed too much also in the sense that I believe the fetchGit feature will be quite controversial.
There was a problem hiding this comment.
Just to clarify: I don't intend to merge this PR until the upstream change to Nix is merged and released (e.g. as Nix 2.12.0 or whatever version it comes out in), upon which I'd change requiredNixVersion here to reflect the Nix version releasing the fetchGit feature. I expect it could be a while before this PR can be safely merged, so I'm not in a rush.
As I mentioned in the pull request discussion, the only reason I opened up this PR right now is not because I'm in a hurry to merge this change, but rather so that this Nixpkgs PR can inform the upstream PR to Nix.
3122054 to
7a06aeb
Compare
|
I rebased this on top of #203963 because the |
This commit has been generated by maintainers/scripts/haskell/update-stackage.sh
This commit has been generated by maintainers/scripts/haskell/update-hackage.sh
This commit has been generated by maintainers/scripts/haskell/regenerate-hackage-packages.sh
This reverts commit 34f6edc. patch is included in 0.9.8
… based on feedback from @MaxGabriel
There are two reasons for doing this: - We can get rid of the hack to remove the dist output from the outputs - We can ensure that any changes that happen in the install phase are correctly reflected in the `dist` export
7a06aeb to
a34d1d5
Compare
|
Sorry for the unnecessary pings. This was a bad rebase on my part. I'll fix this |
This adds a new
incrementalutility for Haskell CI that supports incremental builds based on the approach outlined in this blog post:https://harry.garrood.me/blog/easy-incremental-haskell-ci-builds-with-ghc-9.4/
The basic idea is that instead of Nix doing a full build for a package, we split every build into two builds:
A full build at an older point in time
e.g. a daily or weekly time boundary
An incremental build relative to the last full build
This incremental build reuses the build products left over from the most recent full build.
In order to do this, though, we need a way to "snap" a package's
gitsource input to an earlier point in time (e.g. a daily boundary or weekly boundary). This would allow multiple incremental builds to share the same full rebuild if they snap to the same time boundary.The approach I went with to make that possible was to extend Nix's
builtins.fetchGitto support a newdateargument and you can find the corresponding PR for that here:NixOS/nix#7362
That is why the
incrementalutility added here requires a sufficiently new version of Nix (one that would incorporate that change, presuming it is merged).This also requires GHC 9.4 or newer in order to pick up a fix to GHC's change detection logic, as described in more detail in the above blog post.
However, if you satisfy those requirements then this works exactly the way you'd expect: all of the incremental builds only have to build the diff since the last time boundary. Moreover, if CI caches the full build then developers can also run
nix buildlocally and only have to build the diff, too.