depot/third_party/nixpkgs/pkgs/development/tools/continuous-integration/hci/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

42 lines
1.6 KiB
Nix

{ crun, haskell, haskellPackages, lib, makeWrapper, stdenv, emptyDirectory }:
let
inherit (haskell.lib.compose) overrideCabal addBuildTools justStaticExecutables appendConfigureFlags;
inherit (lib) makeBinPath;
bundledBins = lib.optional stdenv.isLinux crun;
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
(o: {
postInstall = ''
${o.postInstall or ""}
mkdir -p $out/libexec
mv $out/bin/hci $out/libexec
makeWrapper $out/libexec/hci $out/bin/hci --prefix PATH : ${lib.escapeShellArg (makeBinPath bundledBins)}
'';
})
(addBuildTools [ makeWrapper ]
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
((if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
(haskellPackages.hercules-ci-cli.override overrides)));
in pkg // {
meta = pkg.meta // {
position = toString ./default.nix + ":1";
};
}