From 38fd1bad36c80e19d4cd5a843afda7bfc27620fe Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 23 May 2023 09:05:45 +0200 Subject: [PATCH] hercules-ci-agent: Add ssh and use makeBinaryWrapper ... like upstream. --- .../hercules-ci-agent/default.nix | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix index a1ed3d6ebe72..205d1bf1dde5 100644 --- a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix +++ b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix @@ -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;