2021-03-09 03:18:52 +00:00
|
|
|
|
{ lib, buildGoPackage, makeWrapper, coreutils, git, openssh, bash, gnused, gnugrep
|
2020-04-24 23:36:52 +00:00
|
|
|
|
, src, version, hasBootstrapScript, postPatch ? ""
|
|
|
|
|
, ... }:
|
|
|
|
|
let
|
|
|
|
|
goPackagePath = "github.com/buildkite/agent";
|
|
|
|
|
in
|
|
|
|
|
buildGoPackage {
|
|
|
|
|
pname = "buildkite-agent";
|
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
|
|
inherit goPackagePath src postPatch;
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
|
|
postInstall = ''
|
2021-02-05 17:12:51 +00:00
|
|
|
|
${lib.optionalString hasBootstrapScript ''
|
2020-04-24 23:36:52 +00:00
|
|
|
|
# Install bootstrap.sh
|
2020-05-15 21:57:56 +00:00
|
|
|
|
mkdir -p $out/libexec/buildkite-agent
|
|
|
|
|
cp $NIX_BUILD_TOP/go/src/${goPackagePath}/templates/bootstrap.sh $out/libexec/buildkite-agent
|
|
|
|
|
sed -e "s|#!/bin/bash|#!${bash}/bin/bash|g" -i $out/libexec/buildkite-agent/bootstrap.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
|
''}
|
|
|
|
|
|
|
|
|
|
# Fix binary name
|
2020-05-15 21:57:56 +00:00
|
|
|
|
mv $out/bin/{agent,buildkite-agent}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
# These are runtime dependencies
|
2020-05-15 21:57:56 +00:00
|
|
|
|
wrapProgram $out/bin/buildkite-agent \
|
2021-02-05 17:12:51 +00:00
|
|
|
|
${lib.optionalString hasBootstrapScript "--set BUILDKITE_BOOTSTRAP_SCRIPT_PATH $out/libexec/buildkite-agent/bootstrap.sh"} \
|
|
|
|
|
--prefix PATH : '${lib.makeBinPath [ openssh git coreutils gnused gnugrep ]}'
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
description = "Build runner for buildkite.com";
|
|
|
|
|
longDescription = ''
|
|
|
|
|
The buildkite-agent is a small, reliable, and cross-platform build runner
|
|
|
|
|
that makes it easy to run automated builds on your own infrastructure.
|
|
|
|
|
It’s main responsibilities are polling buildkite.com for work, running
|
|
|
|
|
build jobs, reporting back the status code and output log of the job,
|
|
|
|
|
and uploading the job's artifacts.
|
|
|
|
|
'';
|
|
|
|
|
homepage = "https://buildkite.com/docs/agent";
|
|
|
|
|
license = licenses.mit;
|
|
|
|
|
maintainers = with maintainers; [ pawelpacana zimbatm rvl ];
|
|
|
|
|
platforms = platforms.unix;
|
|
|
|
|
};
|
|
|
|
|
}
|