nixpkgs/pkgs/development/tools/continuous-integration/gitlab-runner/default.nix

67 lines
2.1 KiB
Nix
Raw Normal View History

2016-09-17 11:07:26 +00:00
{ lib, buildGoPackage, fetchFromGitLab, fetchurl, go-bindata }:
let
2016-10-22 21:24:47 +00:00
version = "1.7.0";
2016-09-17 11:07:26 +00:00
# Gitlab runner embeds some docker images these are prebuilt for arm and x86_64
docker_x86_64 = fetchurl {
url = "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v${version}/docker/prebuilt-x86_64.tar.xz";
2016-10-22 21:24:47 +00:00
sha256 = "1qc0kmb6wxsy73vf0k2x95jlfb5dicgxw8c63mfn7ryxrh8a42z5";
2016-09-17 11:07:26 +00:00
};
docker_arm = fetchurl {
url = "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v${version}/docker/prebuilt-arm.tar.xz";
2016-10-22 21:24:47 +00:00
sha256 = "0jbgpv4y0fmvl1plri4ifj1vmk6rr82pncrccpz2k640nlniyhqi";
2016-09-17 11:07:26 +00:00
};
in
buildGoPackage rec {
inherit version;
name = "gitlab-runner-${version}";
goPackagePath = "gitlab.com/gitlab-org/gitlab-ci-multi-runner";
commonPackagePath = "${goPackagePath}/common";
buildFlagsArray = ''
-ldflags=
-X ${commonPackagePath}.NAME=gitlab-runner
-X ${commonPackagePath}.VERSION=${version}
-X ${commonPackagePath}.REVISION=v${version}
'';
src = fetchFromGitLab {
owner = "gitlab-org";
repo = "gitlab-ci-multi-runner";
rev = "v${version}";
2016-10-22 21:24:47 +00:00
sha256 = "18wlab63fmmq9kgr0zmkgsr1kj6rjdqmyg87b7ryb9f40gmygcvj";
2016-09-17 11:07:26 +00:00
};
buildInputs = [ go-bindata ];
preBuild = ''
(
# go-bindata names the assets after the filename thus we create a symlink with the name we want
cd go/src/${goPackagePath}
ln -sf ${docker_x86_64} prebuilt-x86_64.tar.xz
ln -sf ${docker_arm} prebuilt-arm.tar.xz
go-bindata \
-pkg docker \
-nocompress \
-nomemcopy \
-o executors/docker/bindata.go \
prebuilt-x86_64.tar.xz \
prebuilt-arm.tar.xz
)
'';
postInstall = ''
install -d $out/bin
# The recommended name is gitlab-runner so we create a symlink with that name
ln -sf gitlab-ci-multi-runner $bin/bin/gitlab-runner
'';
meta = with lib; {
description = "GitLab Runner the continous integration executor of GitLab";
license = licenses.mit;
homepage = "https://about.gitlab.com/gitlab-ci/";
platforms = platforms.unix;
maintainers = [ lib.maintainers.bachp ];
};
}