gitlab-runner service: only depend on docker if enabled

This commit is contained in:
Franz Pletz 2017-05-11 22:29:09 +02:00
parent 482f9862e5
commit 0cd0581b75
No known key found for this signature in database
GPG Key ID: 846FDED7792617B4

View File

@ -5,6 +5,7 @@ with lib;
let
cfg = config.services.gitlab-runner;
configFile = pkgs.writeText "config.toml" cfg.configText;
hasDocker = config.virtualisation.docker.enable;
in
{
options.services.gitlab-runner = {
@ -33,8 +34,9 @@ in
config = mkIf cfg.enable {
systemd.services.gitlab-runner = {
description = "Gitlab Runner";
after = [ "network.target" "docker.service" ];
requires = [ "docker.service" ];
after = [ "network.target" ]
++ optional hasDocker "docker.service";
requires = optional hasDocker "docker.service";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''${cfg.package.bin}/bin/gitlab-runner run \
@ -51,7 +53,7 @@ in
users.extraUsers.gitlab-runner = {
group = "gitlab-runner";
extraGroups = [ "docker" ];
extraGroups = optional hasDocker "docker";
uid = config.ids.uids.gitlab-runner;
home = cfg.workDir;
createHome = true;