| 
									
										
										
										
											2024-11-30 00:30:57 -05:00
										 |  |  | { | 
					
						
							|  |  |  |   config, | 
					
						
							|  |  |  |   ... | 
					
						
							|  |  |  | }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let | 
					
						
							|  |  |  |   vars = import ../vars.nix; | 
					
						
							|  |  |  |   act_path = vars.primary_act; | 
					
						
							| 
									
										
										
										
											2025-03-25 23:24:19 -04:00
										 |  |  |   act_config_path = ./act_config.yaml; | 
					
						
							| 
									
										
										
										
											2024-11-30 00:30:57 -05:00
										 |  |  | in | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2025-01-26 12:43:05 -05:00
										 |  |  |   virtualisation.oci-containers.containers = { | 
					
						
							| 
									
										
										
										
											2025-03-03 11:35:05 -05:00
										 |  |  |     act-stable-latest-main = { | 
					
						
							| 
									
										
										
										
											2025-08-24 21:07:45 -04:00
										 |  |  |       image = "gitea/act_runner:nightly"; | 
					
						
							| 
									
										
										
										
											2025-06-01 18:35:15 -04:00
										 |  |  |       pull = "always"; | 
					
						
							| 
									
										
										
										
											2025-03-03 11:35:05 -05:00
										 |  |  |       extraOptions = [ | 
					
						
							|  |  |  |         "--stop-signal=SIGINT" | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |       labels = { | 
					
						
							|  |  |  |         "com.centurylinklabs.watchtower.enable" = "true"; | 
					
						
							|  |  |  |         "com.centurylinklabs.watchtower.scope" = "act-runner"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |       ports = [ "8088:8088" ]; | 
					
						
							|  |  |  |       volumes = [ | 
					
						
							| 
									
										
										
										
											2025-03-25 23:24:19 -04:00
										 |  |  |         "${act_config_path}:/config.yaml" | 
					
						
							| 
									
										
										
										
											2025-03-03 11:35:05 -05:00
										 |  |  |         "${act_path}/stable-latest-main/data:/data" | 
					
						
							|  |  |  |         "/var/run/docker.sock:/var/run/docker.sock" | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |       environment = { | 
					
						
							|  |  |  |         CONFIG_FILE = "/config.yaml"; | 
					
						
							|  |  |  |         GITEA_RUNNER_NAME = "stable-latest-main"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |       environmentFiles = [ config.sops.secrets."docker/act-runner".path ]; | 
					
						
							|  |  |  |       log-driver = "local"; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-26 12:43:05 -05:00
										 |  |  |     act-stable-latest-1 = { | 
					
						
							| 
									
										
										
										
											2025-08-24 21:07:45 -04:00
										 |  |  |       image = "gitea/act_runner:nightly"; | 
					
						
							| 
									
										
										
										
											2025-06-01 18:35:15 -04:00
										 |  |  |       pull = "always"; | 
					
						
							| 
									
										
										
										
											2025-01-26 12:43:05 -05:00
										 |  |  |       extraOptions = [ | 
					
						
							|  |  |  |         "--stop-signal=SIGINT" | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |       labels = { | 
					
						
							|  |  |  |         "com.centurylinklabs.watchtower.enable" = "true"; | 
					
						
							|  |  |  |         "com.centurylinklabs.watchtower.scope" = "act-runner"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |       volumes = [ | 
					
						
							| 
									
										
										
										
											2025-03-25 23:24:19 -04:00
										 |  |  |         "${./act_config.yaml}:/config.yaml" | 
					
						
							| 
									
										
										
										
											2025-01-26 12:43:05 -05:00
										 |  |  |         "${act_path}/stable-latest-1/data:/data" | 
					
						
							|  |  |  |         "/var/run/docker.sock:/var/run/docker.sock" | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |       environment = { | 
					
						
							|  |  |  |         CONFIG_FILE = "/config.yaml"; | 
					
						
							|  |  |  |         GITEA_RUNNER_NAME = "stable-latest-1"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |       environmentFiles = [ config.sops.secrets."docker/act-runner".path ]; | 
					
						
							|  |  |  |       log-driver = "local"; | 
					
						
							| 
									
										
										
										
											2024-11-30 00:30:57 -05:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2025-01-26 12:43:05 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     act-stable-latest-2 = { | 
					
						
							| 
									
										
										
										
											2025-08-24 21:07:45 -04:00
										 |  |  |       image = "gitea/act_runner:nightly"; | 
					
						
							| 
									
										
										
										
											2025-06-01 18:35:15 -04:00
										 |  |  |       pull = "always"; | 
					
						
							| 
									
										
										
										
											2025-01-26 12:43:05 -05:00
										 |  |  |       extraOptions = [ | 
					
						
							|  |  |  |         "--stop-signal=SIGINT" | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |       labels = { | 
					
						
							|  |  |  |         "com.centurylinklabs.watchtower.enable" = "true"; | 
					
						
							|  |  |  |         "com.centurylinklabs.watchtower.scope" = "act-runner"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |       volumes = [ | 
					
						
							| 
									
										
										
										
											2025-03-25 23:24:19 -04:00
										 |  |  |         "${act_config_path}:/config.yaml" | 
					
						
							| 
									
										
										
										
											2025-01-26 12:43:05 -05:00
										 |  |  |         "${act_path}/stable-latest-2/data:/data" | 
					
						
							|  |  |  |         "/var/run/docker.sock:/var/run/docker.sock" | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |       environment = { | 
					
						
							|  |  |  |         CONFIG_FILE = "/config.yaml"; | 
					
						
							|  |  |  |         GITEA_RUNNER_NAME = "stable-latest-2"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |       environmentFiles = [ config.sops.secrets."docker/act-runner".path ]; | 
					
						
							|  |  |  |       log-driver = "local"; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2024-12-04 18:56:39 -05:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2024-11-30 00:30:57 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   systemd = { | 
					
						
							|  |  |  |     timers."custom-watchtower@act-runner" = { | 
					
						
							|  |  |  |       wantedBy = [ "timers.target" ]; | 
					
						
							|  |  |  |       timerConfig = { | 
					
						
							|  |  |  |         OnBootSec = "20m"; | 
					
						
							|  |  |  |         OnUnitActiveSec = "5m"; | 
					
						
							|  |  |  |         Unit = "custom-watchtower@act-runner.service"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     services."custom-watchtower@act-runner" = { | 
					
						
							|  |  |  |       bindsTo = [ "docker.service" ]; | 
					
						
							|  |  |  |       after = [ "docker.service" ]; | 
					
						
							|  |  |  |       description = "a watchtower-esque script for systemd-based oci-containers"; | 
					
						
							|  |  |  |       serviceConfig = { | 
					
						
							|  |  |  |         Type = "oneshot"; | 
					
						
							|  |  |  |         User = "root"; | 
					
						
							|  |  |  |         ExecStart = "${config.nix.package}/bin/nix ${./watchtower.bash} 'com.centurylinklabs.watchtower.scope' 'act-runner'"; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   sops.secrets = { | 
					
						
							|  |  |  |     "docker/act-runner" = { | 
					
						
							|  |  |  |       owner = "root"; | 
					
						
							|  |  |  |       restartUnits = [ | 
					
						
							| 
									
										
										
										
											2025-03-25 10:24:08 -04:00
										 |  |  |         "docker-act-stable-latest-main.service" | 
					
						
							| 
									
										
										
										
											2024-11-30 00:30:57 -05:00
										 |  |  |         "docker-act-stable-latest-1.service" | 
					
						
							| 
									
										
										
										
											2025-03-25 10:24:08 -04:00
										 |  |  |         "docker-act-stable-latest-2.service" | 
					
						
							| 
									
										
										
										
											2024-11-30 00:30:57 -05:00
										 |  |  |       ]; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } |