summary refs log tree commit diff
path: root/pkgs/development/tools/continuous-integration/buildkite-agent
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2017-10-20 18:16:05 +0100
committerDomen Kožar <domen@enlambda.com>2017-10-21 11:23:30 +0100
commit96b339fbc93899b42a4b897d0db9854397d90159 (patch)
tree07c8fdb57573f0368f7e3755b3cb36ac3b002cfa /pkgs/development/tools/continuous-integration/buildkite-agent
parent525e1216265ebdb039f54cfa3ae24db7c6c5168a (diff)
downloadnixpkgs-96b339fbc93899b42a4b897d0db9854397d90159.tar
nixpkgs-96b339fbc93899b42a4b897d0db9854397d90159.tar.gz
nixpkgs-96b339fbc93899b42a4b897d0db9854397d90159.tar.bz2
nixpkgs-96b339fbc93899b42a4b897d0db9854397d90159.tar.lz
nixpkgs-96b339fbc93899b42a4b897d0db9854397d90159.tar.xz
nixpkgs-96b339fbc93899b42a4b897d0db9854397d90159.tar.zst
nixpkgs-96b339fbc93899b42a4b897d0db9854397d90159.zip
buildkite-agent: 2.1.13 -> 2.6.6
Build the package from source

Re-organise the module a bit to allow custom version of the package
Diffstat (limited to 'pkgs/development/tools/continuous-integration/buildkite-agent')
-rw-r--r--pkgs/development/tools/continuous-integration/buildkite-agent/default.nix52
1 files changed, 29 insertions, 23 deletions
diff --git a/pkgs/development/tools/continuous-integration/buildkite-agent/default.nix b/pkgs/development/tools/continuous-integration/buildkite-agent/default.nix
index 10d4a3f0f28..46cee51e0e6 100644
--- a/pkgs/development/tools/continuous-integration/buildkite-agent/default.nix
+++ b/pkgs/development/tools/continuous-integration/buildkite-agent/default.nix
@@ -1,32 +1,38 @@
-{ stdenv, fetchurl, makeWrapper, coreutils, git, openssh, bash, gnused, gnugrep }:
-
-stdenv.mkDerivation rec {
-  version = "2.1.13";
+{ stdenv, buildGoPackage, fetchFromGitHub, makeWrapper, coreutils, git, openssh, bash, gnused, gnugrep }:
+let
+  version = "2.6.6";
+  goPackagePath = "github.com/buildkite/agent";
+in
+buildGoPackage {
   name = "buildkite-agent-${version}";
-  dontBuild = true;
 
-  src = fetchurl {
-    url = "https://github.com/buildkite/agent/releases/download/v${version}/buildkite-agent-linux-386-${version}.tar.gz";
-    sha256 = "bd40c2ba37b3b54b875241a32b62190a4cf4c15e2513c573f1626a3ca35c8657";
+  inherit goPackagePath;
+
+  src = fetchFromGitHub {
+    owner = "buildkite";
+    repo = "agent";
+    rev = "v${version}";
+    sha256 = "0rpi63mfzlm39517l4xjcka3m4dnfjzwvpi0i1rpf1z2288cnkyx";
   };
 
   nativeBuildInputs = [ makeWrapper ];
-  sourceRoot = ".";
-  installPhase = ''
-    install -Dt "$out/bin/" buildkite-agent
 
-    mkdir -p $out/share
-    mv hooks bootstrap.sh $out/share/
-  '';
+  postInstall = ''
+    # Install bootstrap.sh
+    mkdir -p $bin/libexec/buildkite-agent
+    cp $NIX_BUILD_TOP/go/src/${goPackagePath}/templates/bootstrap.sh $bin/libexec/buildkite-agent
+    sed -e "s|#!/bin/bash|#!${bash}/bin/bash|g" -i $bin/libexec/buildkite-agent/bootstrap.sh
+
+    # Fix binary name
+    mv $bin/bin/{agent,buildkite-agent}
 
-  postFixup = ''
-    substituteInPlace $out/share/bootstrap.sh \
-      --replace "#!/bin/bash" "#!$(type -P bash)"
-    wrapProgram $out/bin/buildkite-agent \
-      --set PATH '"${stdenv.lib.makeBinPath [ openssh git coreutils gnused gnugrep ]}:$PATH"'
+    # These are runtime dependencies
+    wrapProgram $bin/bin/buildkite-agent \
+      --prefix PATH : '${stdenv.lib.makeBinPath [ openssh git coreutils gnused gnugrep ]}' \
+      --set BUILDKITE_BOOTSTRAP_SCRIPT_PATH $bin/libexec/buildkite-agent/bootstrap.sh
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Build runner for buildkite.com";
     longDescription = ''
       The buildkite-agent is a small, reliable, and cross-platform build runner
@@ -36,8 +42,8 @@ stdenv.mkDerivation rec {
       and uploading the job's artifacts.
     '';
     homepage = https://buildkite.com/docs/agent;
-    license = stdenv.lib.licenses.mit;
-    maintainers = [ stdenv.lib.maintainers.pawelpacana ];
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.mit;
+    maintainers = with maintainers; [ pawelpacana zimbatm ];
+    platforms = platforms.linux;
   };
 }