Commit 38fd1bad authored by Robert Hensing's avatar Robert Hensing
Browse files

hercules-ci-agent: Add ssh and use makeBinaryWrapper

... like upstream.
parent 0d405840
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
{ 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;