From f6bda933ea5d39e285cb34635f83c05f2cb959ce Mon Sep 17 00:00:00 2001 From: ahuston-0 Date: Sun, 23 Jun 2024 15:54:33 -0400 Subject: [PATCH] allow all containers, add bind mounts Signed-off-by: ahuston-0 --- lib/default.nix | 21 ++- systems/palatine-hill/docker/archiveteam.nix | 171 ++++++++++--------- 2 files changed, 100 insertions(+), 92 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index 0d07a82..eacdf47 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -66,8 +66,9 @@ # where image-uri gets passed in to the container-spec function as a custom # parameter, and scale is an integer that generates the containers # - # container-spec must be a function which accepts one parameter (the - # container name) and ideally returns an oci-compliant container. + # container-spec must be a function which accepts two parameter (the + # container name and image name) and ideally returns an oci-compliant + # container. # # args: # containers: an AttrSet which specifies the imageUri and scale of each @@ -75,17 +76,23 @@ # container-spec: a function which produces an oci-compliant container spec # # type: - # AttrSet -> (AttrSet -> AttrSet) -> AttrSet + # AttrSet -> (String -> AttrSet -> AttrSet) -> AttrSet createTemplatedContainers = containers: container-spec: builtins.listToAttrs ( lib.flatten ( lib.mapAttrsToList ( name: value: - (map (num: { - name = "${name}-${parseInt num}"; - value = container-spec value.image; - }) (lib.lists.range 1 value.scale)) + (map ( + num: + let + container-name = "${name}-${toString num}"; + in + { + name = container-name; + value = container-spec container-name value.image; + } + ) (lib.lists.range 1 value.scale)) ) containers ) ); diff --git a/systems/palatine-hill/docker/archiveteam.nix b/systems/palatine-hill/docker/archiveteam.nix index 377d93a..ea3d869 100644 --- a/systems/palatine-hill/docker/archiveteam.nix +++ b/systems/palatine-hill/docker/archiveteam.nix @@ -11,98 +11,99 @@ let image = "imgur-grab"; scale = 1; }; - #archiveteam-telegram = { - # image = "telegram-grab"; - # scale = 3; - #}; - #archiveteam-reddit = { - # image = "reddit-grab"; - # scale = 1; - #}; - #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 = 0; - #}; - #archiveteam-vbox7 = { - # image = "vbox7-grab"; - # scale = 0; - #}; - #archiveteam-pastebin = { - # image = "pastebin-grab"; - # scale = 1; - #}; - #archiveteam-youtube = { - # image = "youtube-grab"; - # scale = 1; - #}; - #archiveteam-deviantart = { - # image = "deviantart-grab"; - # scale = 1; - #}; - #archiveteam-postnews = { - # image = "postnews-grab"; - # scale = 1; - #}; + archiveteam-telegram = { + image = "telegram-grab"; + scale = 3; + }; + archiveteam-reddit = { + image = "reddit-grab"; + scale = 1; + }; + 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 = 0; + }; + archiveteam-vbox7 = { + image = "vbox7-grab"; + scale = 0; + }; + archiveteam-pastebin = { + image = "pastebin-grab"; + scale = 1; + }; + archiveteam-youtube = { + image = "youtube-grab"; + scale = 1; + }; + archiveteam-deviantart = { + image = "deviantart-grab"; + scale = 1; + }; + archiveteam-postnews = { + image = "postnews-grab"; + scale = 1; + }; }; - container-spec = container: { + container-spec = container-name: container: { image = "atdr.meo.ws/archiveteam/${container}"; extraOptions = [ "--stop-signal=SIGINT" ]; labels = { "com.centurylinklabs.watchtower.enable" = "true"; "com.centurylinklabs.watchtower.scope" = "archiveteam"; }; + volumes = [ "/ZFS/ZFS-primary/archiveteam/${container-name}:/grab/data" ]; log-driver = "local"; cmd = lib.splitString " " "--concurrent 6 AmAnd0";