1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/development/tools/continuous-integration/gitlab-runner/default.nix

67 lines
2 KiB
Nix
Raw Normal View History

2016-09-17 12:07:26 +01:00
{ lib, buildGoPackage, fetchFromGitLab, fetchurl, go-bindata }:
let
2018-01-24 21:32:22 +00:00
version = "10.4.0";
2016-09-17 12:07:26 +01:00
# Gitlab runner embeds some docker images these are prebuilt for arm and x86_64
docker_x86_64 = fetchurl {
url = "https://gitlab-runner-downloads.s3.amazonaws.com/v${version}/docker/prebuilt-x86_64.tar.xz";
2018-01-24 21:32:22 +00:00
sha256 = "0fcddi1mwgj831abn628zcpwsah3mmvrbdi851pjf8vraynwr2xa";
2016-09-17 12:07:26 +01:00
};
docker_arm = fetchurl {
url = "https://gitlab-runner-downloads.s3.amazonaws.com/v${version}/docker/prebuilt-arm.tar.xz";
2018-01-24 21:32:22 +00:00
sha256 = "1zlk3i9jzmsqz5r3kzg08z9hyhidw9dpv5ji46bnbjis8q3dlw54";
2016-09-17 12:07:26 +01:00
};
in
buildGoPackage rec {
inherit version;
name = "gitlab-runner-${version}";
goPackagePath = "gitlab.com/gitlab-org/gitlab-runner";
2016-09-17 12:07:26 +01:00
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-runner";
2016-09-17 12:07:26 +01:00
rev = "v${version}";
2018-01-24 21:32:22 +00:00
sha256 = "0kp6h53d1q652i4wp94hydy1ixlgmqh92sjsc6pqicnfc7nvwgfq";
2016-09-17 12:07:26 +01:00
};
patches = [ ./fix-shell-path.patch ];
2016-09-17 12:07:26 +01: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
'';
meta = with lib; {
2016-12-25 11:35:47 +00:00
description = "GitLab Runner the continuous integration executor of GitLab";
2016-09-17 12:07:26 +01:00
license = licenses.mit;
homepage = https://about.gitlab.com/gitlab-ci/;
2017-05-24 11:18:56 +01:00
platforms = platforms.unix ++ platforms.darwin;
maintainers = with maintainers; [ bachp zimbatm ];
2016-09-17 12:07:26 +01:00
};
}