153 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			153 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   config,
 | |
|   lib,
 | |
|   pkgs,
 | |
|   ...
 | |
| }:
 | |
| 
 | |
| let
 | |
|   containers = {
 | |
|     archiveteam-imgur = {
 | |
|       image = "imgur-grab";
 | |
|       scale = 1;
 | |
|     };
 | |
|     archiveteam-telegram = {
 | |
|       image = "telegram-grab";
 | |
|       scale = 3;
 | |
|     };
 | |
|     archiveteam-reddit = {
 | |
|       image = "reddit-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-dpreview = {
 | |
|       image = "dpreview-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-issuu = {
 | |
|       image = "issuu-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-urls = {
 | |
|       image = "urls-grab";
 | |
|       scale = 2;
 | |
|     };
 | |
|     archiveteam-urlteam = {
 | |
|       image = "terroroftinytown-client-grab";
 | |
|       scale = 2;
 | |
|     };
 | |
|     archiveteam-mediafire = {
 | |
|       image = "mediafire-grab";
 | |
|       scale = 1;
 | |
|     };
 | |
|     archiveteam-github = {
 | |
|       image = "github-grab";
 | |
|       scale = 1;
 | |
|     };
 | |
|     archiveteam-lineblog = {
 | |
|       image = "lineblog-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-banciyuan = {
 | |
|       image = "banciyuan-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-wysp = {
 | |
|       image = "wysp-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-xuite = {
 | |
|       image = "xuite-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-gfycat = {
 | |
|       image = "gfycat-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-skyblog = {
 | |
|       image = "skyblog-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-zowa = {
 | |
|       image = "zowa-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-blogger = {
 | |
|       image = "blogger-grab";
 | |
|       scale = 1;
 | |
|     };
 | |
|     archiveteam-vbox7 = {
 | |
|       image = "vbox7-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-pastebin = {
 | |
|       image = "pastebin-grab";
 | |
|       scale = 1;
 | |
|     };
 | |
|     archiveteam-youtube = {
 | |
|       image = "youtube-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-deviantart = {
 | |
|       image = "deviantart-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-postnews = {
 | |
|       image = "postnews-grab";
 | |
|       scale = 0;
 | |
|     };
 | |
|     archiveteam-askfm = {
 | |
|       image = "askfm-grab";
 | |
|       scale = 1;
 | |
|     };
 | |
|     archiveteam-mangz = {
 | |
|       image = "mangaz-grab";
 | |
|       scale = 1;
 | |
|     };
 | |
|     archiveteam-cohost = {
 | |
|       image = "cohost-grab";
 | |
|       scale = 1;
 | |
|     };
 | |
|   };
 | |
|   container-spec = container-name: container: {
 | |
|     image = "atdr.meo.ws/archiveteam/${container}:latest";
 | |
|     extraOptions = [
 | |
|       "--stop-signal=SIGINT"
 | |
|     ];
 | |
|     labels = {
 | |
|       "com.centurylinklabs.watchtower.enable" = "true";
 | |
|       "com.centurylinklabs.watchtower.scope" = "archiveteam";
 | |
|     };
 | |
|     volumes = [ "${at_path}/${container-name}:/grab/data" ];
 | |
|     log-driver = "local";
 | |
|     cmd = lib.splitString " " "--concurrent 6 AmAnd0";
 | |
| 
 | |
|   };
 | |
|   inherit (lib.adev.container-utils) createTemplatedContainers;
 | |
| 
 | |
|   vars = import ../vars.nix;
 | |
|   at_path = vars.primary_archiveteam;
 | |
| in
 | |
| {
 | |
|   virtualisation.oci-containers.containers = createTemplatedContainers containers container-spec;
 | |
|   systemd = {
 | |
|     timers."custom-watchtower@archiveteam" = {
 | |
|       wantedBy = [ "timers.target" ];
 | |
|       timerConfig = {
 | |
|         OnBootSec = "20m";
 | |
|         OnUnitActiveSec = "5m";
 | |
|         Unit = "custom-watchtower@archiveteam.service";
 | |
|       };
 | |
|     };
 | |
|     services."custom-watchtower@archiveteam" = {
 | |
|       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' 'archiveteam'";
 | |
|       };
 | |
|     };
 | |
|   };
 | |
| }
 |