hercules-ci-agent: Add ssh and use makeBinaryWrapper

... like upstream.
This commit is contained in:
Robert Hensing 2023-05-23 09:05:45 +02:00
parent 0d405840d3
commit 38fd1bad36

View File

@ -1,8 +1,21 @@
{ gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper, nixos, runc, stdenv }:
{
git,
gnutar,
gzip,
haskell,
haskellPackages,
lib,
makeBinaryWrapper,
nixos,
openssh,
runc,
runCommand,
stdenv,
}:
let
inherit (haskell.lib.compose) overrideCabal addBuildTools justStaticExecutables;
inherit (lib) makeBinPath;
bundledBins = [ gnutar gzip git ] ++ lib.optional stdenv.isLinux runc;
bundledBins = [ gnutar gzip git openssh ] ++ lib.optional stdenv.isLinux runc;
pkg =
# justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990
@ -15,12 +28,19 @@ let
makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${lib.escapeShellArg (makeBinPath bundledBins)}
'';
})
(addBuildTools [ makeWrapper ] (justStaticExecutables haskellPackages.hercules-ci-agent));
in pkg.overrideAttrs (o: {
(addBuildTools [ makeBinaryWrapper ] (justStaticExecutables haskellPackages.hercules-ci-agent));
in pkg.overrideAttrs (finalAttrs: o: {
meta = o.meta // {
position = toString ./default.nix + ":1";
};
passthru = o.passthru // {
tests.help = runCommand "test-hercules-ci-agent-help" { } ''
(${finalAttrs.finalPackage}/bin/hercules-ci-agent --help 2>&1 || true) | grep -F -- '--config'
(${lib.getExe finalAttrs.finalPackage} --help 2>&1 || true) | grep -F -- '--config'
touch $out
'';
# Does not test the package, but evaluation of the related NixOS module.
tests.nixos-simple-config = (nixos {
boot.loader.grub.enable = false;