nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, buildGoPackage, fetchFromGitLab, fetchurl }:
2
3let
4 version = "12.7.0";
5 # Gitlab runner embeds some docker images these are prebuilt for arm and x86_64
6 docker_x86_64 = fetchurl {
7 url = "https://gitlab-runner-downloads.s3.amazonaws.com/v${version}/helper-images/prebuilt-x86_64.tar.xz";
8 sha256 = "0vaaaw6hxmr55kgcn86rim9in96zmyv0zhl7asr4b7qknabsjp4m";
9 };
10
11 docker_arm = fetchurl {
12 url = "https://gitlab-runner-downloads.s3.amazonaws.com/v${version}/helper-images/prebuilt-arm.tar.xz";
13 sha256 = "031fv7f15wiqq7209n2ab7n3qzjf7cjzvbp4pkz24bkc3lr3y773";
14 };
15in
16buildGoPackage rec {
17 inherit version;
18 pname = "gitlab-runner";
19 goPackagePath = "gitlab.com/gitlab-org/gitlab-runner";
20 commonPackagePath = "${goPackagePath}/common";
21 buildFlagsArray = ''
22 -ldflags=
23 -X ${commonPackagePath}.NAME=gitlab-runner
24 -X ${commonPackagePath}.VERSION=${version}
25 -X ${commonPackagePath}.REVISION=v${version}
26 '';
27
28 src = fetchFromGitLab {
29 owner = "gitlab-org";
30 repo = "gitlab-runner";
31 rev = "v${version}";
32 sha256 = "0f08syk7v7w89pcdbzwgscsxl54gnms1qd4spjppnq4h5r959jp2";
33 };
34
35 patches = [ ./fix-shell-path.patch ];
36
37 postInstall = ''
38 touch $bin/bin/hello
39 install -d $bin/bin/helper-images
40 ln -sf ${docker_x86_64} $bin/bin/helper-images/prebuilt-x86_64.tar.xz
41 ln -sf ${docker_arm} $bin/bin/helper-images/prebuilt-arm.tar.xz
42 '';
43
44 meta = with lib; {
45 description = "GitLab Runner the continuous integration executor of GitLab";
46 license = licenses.mit;
47 homepage = https://about.gitlab.com/gitlab-ci/;
48 platforms = platforms.unix ++ platforms.darwin;
49 maintainers = with maintainers; [ bachp zimbatm globin ];
50 };
51}