gitlab-runner service: initial version
This commit is contained in:
parent
373b37f179
commit
de38c1bca0
2
nixos/modules/misc/ids.nix
Normal file → Executable file
2
nixos/modules/misc/ids.nix
Normal file → Executable file
@ -275,6 +275,7 @@
|
||||
mattermost = 254;
|
||||
prometheus = 255;
|
||||
telegraf = 256;
|
||||
gitlab-runner = 257;
|
||||
|
||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||
|
||||
@ -520,6 +521,7 @@
|
||||
mattermost = 254;
|
||||
prometheus = 255;
|
||||
#telegraf = 256; # unused
|
||||
gitlab-runner = 257;
|
||||
|
||||
# When adding a gid, make sure it doesn't match an existing
|
||||
# uid. Users and groups with the same name should have equal
|
||||
|
@ -133,6 +133,7 @@
|
||||
./services/computing/slurm/slurm.nix
|
||||
./services/continuous-integration/buildkite-agent.nix
|
||||
./services/continuous-integration/hydra/default.nix
|
||||
./services/continuous-integration/gitlab-runner.nix
|
||||
./services/continuous-integration/gocd-agent/default.nix
|
||||
./services/continuous-integration/gocd-server/default.nix
|
||||
./services/continuous-integration/jenkins/default.nix
|
||||
|
@ -0,0 +1,51 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.gitlab-runner;
|
||||
configFile = pkgs.writeText "config.toml" cfg.configText;
|
||||
in
|
||||
{
|
||||
options.services.gitlab-runner = {
|
||||
enable = mkEnableOption "Gitlab Runner";
|
||||
|
||||
configText = mkOption {
|
||||
description = "Verbatim config.toml to use";
|
||||
};
|
||||
|
||||
workDir = mkOption {
|
||||
default = "/var/lib/gitlab-runner";
|
||||
type = types.path;
|
||||
description = "The working directory used";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.gitlab-runner = {
|
||||
description = "Gitlab Runner";
|
||||
after = [ "network.target" "docker.service" ];
|
||||
requires = [ "docker.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = ''${pkgs.gitlab-runner.bin}/bin/gitlab-runner run \
|
||||
--working-directory ${cfg.workDir} \
|
||||
--config ${configFile} \
|
||||
--service gitlab-runner \
|
||||
--user gitlab-runner \
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
users.extraUsers.gitlab-runner = {
|
||||
group = "gitlab-runner";
|
||||
extraGroups = [ "docker" ];
|
||||
uid = config.ids.uids.gitlab-runner;
|
||||
home = cfg.workDir;
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
users.extraGroups.gitlab-runner.gid = config.ids.gids.gitlab-runner;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user