mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
gitlab-runner service: initial version
This commit is contained in:
parent
373b37f179
commit
de38c1bca0
3 changed files with 54 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue