summary refs log tree commit diff
diff options
context:
space:
mode:
authorStefan Frijters <sfrijters@gmail.com>2023-02-19 18:19:32 +0100
committerMatthieu Coudron <teto@users.noreply.github.com>2023-02-27 22:24:14 +0100
commit2af041ab44ce4b8c10b015ff3674c0852d193a75 (patch)
treefec6e32b444e2548adc3f74a041451a461bf3092
parent84e04bd391dc4f47cdc600fbe850ed26a27cc286 (diff)
downloadnixpkgs-2af041ab44ce4b8c10b015ff3674c0852d193a75.tar
nixpkgs-2af041ab44ce4b8c10b015ff3674c0852d193a75.tar.gz
nixpkgs-2af041ab44ce4b8c10b015ff3674c0852d193a75.tar.bz2
nixpkgs-2af041ab44ce4b8c10b015ff3674c0852d193a75.tar.lz
nixpkgs-2af041ab44ce4b8c10b015ff3674c0852d193a75.tar.xz
nixpkgs-2af041ab44ce4b8c10b015ff3674c0852d193a75.tar.zst
nixpkgs-2af041ab44ce4b8c10b015ff3674c0852d193a75.zip
nixos/gitlab-runner: do not pull in Docker if gitlab-runner-clear-docker-cache is disabled
Only create the service if the option is enabled and if any docker executors exist.
-rw-r--r--nixos/modules/services/continuous-integration/gitlab-runner.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/services/continuous-integration/gitlab-runner.nix b/nixos/modules/services/continuous-integration/gitlab-runner.nix
index 6b44d39c224..53f39f40daa 100644
--- a/nixos/modules/services/continuous-integration/gitlab-runner.nix
+++ b/nixos/modules/services/continuous-integration/gitlab-runner.nix
@@ -577,7 +577,7 @@ in {
       };
     };
     # Enable periodic clear-docker-cache script
-    systemd.services.gitlab-runner-clear-docker-cache = {
+    systemd.services.gitlab-runner-clear-docker-cache = mkIf (cfg.clear-docker-cache.enable && (any (s: s.executor == "docker") (attrValues cfg.services))) {
       description = "Prune gitlab-runner docker resources";
       restartIfChanged = false;
       unitConfig.X-StopOnRemoval = false;
@@ -590,7 +590,7 @@ in {
         ${pkgs.gitlab-runner}/bin/clear-docker-cache ${toString cfg.clear-docker-cache.flags}
       '';
 
-      startAt = optional cfg.clear-docker-cache.enable cfg.clear-docker-cache.dates;
+      startAt = cfg.clear-docker-cache.dates;
     };
     # Enable docker if `docker` executor is used in any service
     virtualisation.docker.enable = mkIf (