Merge pull request #259359 from hercules-ci/hci-output-closure-size

hci: Improve closure size
This commit is contained in:
Robert Hensing
2023-10-07 13:17:55 +02:00
committed by GitHub
@@ -1,9 +1,25 @@
{ haskell, haskellPackages, lib, makeWrapper, runc, stdenv }:
{ haskell, haskellPackages, lib, makeWrapper, runc, stdenv, emptyDirectory }:
let
inherit (haskell.lib.compose) overrideCabal addBuildTools justStaticExecutables;
inherit (haskell.lib.compose) overrideCabal addBuildTools justStaticExecutables appendConfigureFlags;
inherit (lib) makeBinPath;
bundledBins = lib.optional stdenv.isLinux runc;
overrides = old: {
hercules-ci-agent =
overrideCabal
(o: {
isLibrary = true;
isExecutable = false;
postInstall = ""; # ignore completions
enableSharedExecutables = false;
buildTarget = "lib:hercules-ci-agent hercules-ci-agent-unit-tests";
configureFlags = o.configureFlags or [ ] ++ [
"--bindir=${emptyDirectory}/hercules-ci-built-without-binaries/no-bin"
];
})
old.hercules-ci-agent;
};
pkg =
# justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990
overrideCabal
@@ -15,7 +31,7 @@ let
makeWrapper $out/libexec/hci $out/bin/hci --prefix PATH : ${lib.escapeShellArg (makeBinPath bundledBins)}
'';
})
(addBuildTools [ makeWrapper ] (justStaticExecutables haskellPackages.hercules-ci-cli));
(addBuildTools [ makeWrapper ] (justStaticExecutables (haskellPackages.hercules-ci-cli.override overrides)));
in pkg // {
meta = pkg.meta // {
position = toString ./default.nix + ":1";