tests.haskell.incremental: init
This commit is contained in:
parent
c072d7867d
commit
b278ca2195
|
@ -6,4 +6,5 @@ lib.recurseIntoAttrs {
|
||||||
documentationTarball = callPackage ./documentationTarball { };
|
documentationTarball = callPackage ./documentationTarball { };
|
||||||
setBuildTarget = callPackage ./setBuildTarget { };
|
setBuildTarget = callPackage ./setBuildTarget { };
|
||||||
writers = callPackage ./writers { };
|
writers = callPackage ./writers { };
|
||||||
|
incremental = callPackage ./incremental { };
|
||||||
}
|
}
|
||||||
|
|
35
pkgs/test/haskell/incremental/default.nix
Normal file
35
pkgs/test/haskell/incremental/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
# Demonstration of incremental builds for Haskell. Useful for speeding up CI.
|
||||||
|
#
|
||||||
|
# See: https://www.haskellforall.com/2022/12/nixpkgs-support-for-incremental-haskell.html
|
||||||
|
# See: https://felixspringer.xyz/homepage/blog/incrementalHaskellBuildsWithNix
|
||||||
|
|
||||||
|
{ haskell, lib }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (haskell.lib.compose) overrideCabal;
|
||||||
|
|
||||||
|
# Incremental builds work with GHC >=9.4.
|
||||||
|
turtle = haskell.packages.ghc944.turtle;
|
||||||
|
|
||||||
|
# This will do a full build of `turtle`, while writing the intermediate build products
|
||||||
|
# (compiled modules, etc.) to the `intermediates` output.
|
||||||
|
turtle-full-build-with-incremental-output = overrideCabal (drv: {
|
||||||
|
doInstallIntermediates = true;
|
||||||
|
enableSeparateIntermediatesOutput = true;
|
||||||
|
}) turtle;
|
||||||
|
|
||||||
|
# This will do an incremental build of `turtle` by copying the previously
|
||||||
|
# compiled modules and intermediate build products into the source tree
|
||||||
|
# before running the build.
|
||||||
|
#
|
||||||
|
# GHC will then naturally pick up and reuse these products, making this build
|
||||||
|
# complete much more quickly than the previous one.
|
||||||
|
turtle-incremental-build = overrideCabal (drv: {
|
||||||
|
previousIntermediates = turtle-full-build-with-incremental-output.intermediates;
|
||||||
|
}) turtle;
|
||||||
|
in
|
||||||
|
turtle-incremental-build.overrideAttrs (old: {
|
||||||
|
meta = {
|
||||||
|
maintainers = lib.teams.mercury.members;
|
||||||
|
};
|
||||||
|
})
|
Loading…
Reference in a new issue