2021-05-20 23:08:51 +00:00
|
|
|
{ gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper, nixos, runc, stdenv }:
|
2020-06-15 15:56:04 +00:00
|
|
|
let
|
|
|
|
inherit (haskell.lib) overrideCabal addBuildDepends;
|
|
|
|
inherit (lib) makeBinPath;
|
2021-03-15 08:37:03 +00:00
|
|
|
bundledBins = [ gnutar gzip git ] ++ lib.optional stdenv.isLinux runc;
|
|
|
|
|
2020-06-15 15:56:04 +00:00
|
|
|
pkg =
|
|
|
|
# justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990
|
|
|
|
overrideCabal
|
|
|
|
(addBuildDepends (haskell.lib.justStaticExecutables haskellPackages.hercules-ci-agent) [ makeWrapper ])
|
|
|
|
(o: {
|
|
|
|
postInstall = ''
|
|
|
|
${o.postInstall or ""}
|
|
|
|
mkdir -p $out/libexec
|
|
|
|
mv $out/bin/hercules-ci-agent $out/libexec
|
2021-03-15 08:37:03 +00:00
|
|
|
makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${makeBinPath bundledBins}
|
2020-06-15 15:56:04 +00:00
|
|
|
'';
|
|
|
|
});
|
2021-05-20 23:08:51 +00:00
|
|
|
in pkg.overrideAttrs (o: {
|
|
|
|
meta = o.meta // {
|
2020-06-15 15:56:04 +00:00
|
|
|
position = toString ./default.nix + ":1";
|
|
|
|
};
|
2021-05-20 23:08:51 +00:00
|
|
|
passthru = o.passthru // {
|
|
|
|
# Does not test the package, but evaluation of the related NixOS module.
|
|
|
|
tests.nixos-minimal-config = nixos {
|
|
|
|
boot.loader.grub.enable = false;
|
|
|
|
fileSystems."/".device = "bogus";
|
|
|
|
services.hercules-ci-agent.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|