aboutsummaryrefslogtreecommitdiff
path: root/nixos
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-12-07 14:44:06 +0100
committerKarel Kočí <cynerd@email.cz>2022-12-07 14:44:06 +0100
commit60b9444ad06eafbe22e00e6dd9c04fb0c9e53993 (patch)
tree8c52d34e72168c1ee80fb3bf253f8f06ba06ff6f /nixos
parente202177b9f94d7ced568bd7b81d6639d6f806006 (diff)
downloadnixos-personal-60b9444ad06eafbe22e00e6dd9c04fb0c9e53993.tar.gz
nixos-personal-60b9444ad06eafbe22e00e6dd9c04fb0c9e53993.tar.bz2
nixos-personal-60b9444ad06eafbe22e00e6dd9c04fb0c9e53993.zip
nixos/mrpump: It is possible to use same runner for multiple projects
Diffstat (limited to 'nixos')
-rw-r--r--nixos/machine/mrpump.nix83
1 files changed, 39 insertions, 44 deletions
diff --git a/nixos/machine/mrpump.nix b/nixos/machine/mrpump.nix
index 623f438..5da00e4 100644
--- a/nixos/machine/mrpump.nix
+++ b/nixos/machine/mrpump.nix
@@ -56,52 +56,47 @@ with lib;
# Gitlab runner
systemd.services.gitlab-runner.serviceConfig = let
- name2var = name: replaceStrings ["-"] ["_"] (toUpper name);
- runners = project: [
- {
- name = "MrPump Docker (${project})";
- url = "https://gitlab.com";
- id = 18138767;
- token = "@TOKEN_${name2var project}_DOCKER@";
- executor = "docker";
- docker = {
- image = "alpine";
- };
- }
- {
- name = "MrPump Nix (${project})";
- url = "https://gitlab.com";
- id = 18139391;
- token = "@TOKEN_${name2var project}_NIX@";
- executor = "docker";
- docker = {
- image = "local/nix:latest";
- allowed_images = ["local/nix:latest"];
- pull_policy = "if-not-present";
- allowed_pull_policies = ["if-not-present"];
- volumes_from = ["gitlabnix:ro"];
- };
- environment = [
- "NIX_REMOTE=daemon"
- "ENV=/etc/profile.d/nix-daemon.sh"
- "BASH_ENV=/etc/profile.d/nix-daemon.sh"
- ];
- # TODO for some reason the /tmp seems to be missing
- # The cp is required to allow modification of nix config for cachix as
- # otherwise it is link to the read only file in the store.
- pre_build_script = ''
- mkdir -p /tmp
- cp --remove-destination \
- $(readlink -f /etc/nix/nix.conf) /etc/nix/nix.conf
- '';
- }
- ];
config = (pkgs.formats.toml{}).generate "gitlab-runner.toml" {
concurrent = 1;
- runners =
- (runners "LogC") ++
- (runners "NixTurris") ++
- (runners "Check-Suite");
+ runners = [
+ {
+ name = "MrPump Docker";
+ url = "https://gitlab.com";
+ id = 18138767;
+ token = "@TOKEN_DOCKER@";
+ executor = "docker";
+ docker = {
+ image = "alpine";
+ };
+ }
+ {
+ name = "MrPump Nix";
+ url = "https://gitlab.com";
+ id = 18139391;
+ token = "@TOKEN_NIX@";
+ executor = "docker";
+ docker = {
+ image = "local/nix:latest";
+ allowed_images = ["local/nix:latest"];
+ pull_policy = "if-not-present";
+ allowed_pull_policies = ["if-not-present"];
+ volumes_from = ["gitlabnix:ro"];
+ };
+ environment = [
+ "NIX_REMOTE=daemon"
+ "ENV=/etc/profile.d/nix-daemon.sh"
+ "BASH_ENV=/etc/profile.d/nix-daemon.sh"
+ ];
+ # TODO for some reason the /tmp seems to be missing
+ # The cp is required to allow modification of nix config for cachix as
+ # otherwise it is link to the read only file in the store.
+ pre_build_script = ''
+ mkdir -p /tmp
+ cp --remove-destination \
+ $(readlink -f /etc/nix/nix.conf) /etc/nix/nix.conf
+ '';
+ }
+ ];
};
configPath = "$HOME/.gitlab-runner/config.toml";
configureScript = pkgs.writeShellScript "gitlab-runner-configure" ''