diff --git a/lib/default.nix b/lib/default.nix index 4e28cdb..6753c1d 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -56,7 +56,7 @@ # type: # fileList :: Path -> String -> [Path] fileList = dir: map (file: dir + "/${file}") (ls dir); - createContainers = + createTemplatedContainers = containers: container-spec: builtins.listToAttrs ( lib.flatten ( @@ -70,6 +70,7 @@ ) ); + # Converts an integer into a string parseInt = num: let diff --git a/systems/palatine-hill/configuration.nix b/systems/palatine-hill/configuration.nix index 1c48d0a..f97be5c 100644 --- a/systems/palatine-hill/configuration.nix +++ b/systems/palatine-hill/configuration.nix @@ -7,6 +7,7 @@ { imports = [ ./attic.nix + ./docker ./docker.nix ./hydra.nix ./minio.nix diff --git a/systems/palatine-hill/docker/archiveteam.nix b/systems/palatine-hill/docker/archiveteam.nix new file mode 100644 index 0000000..78d477d --- /dev/null +++ b/systems/palatine-hill/docker/archiveteam.nix @@ -0,0 +1,123 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + containers = { + imgur = { + image = "imgur-grab"; + scale = 1; + }; + telegram = { + image = "telegram-grab"; + scale = 3; + }; + reddit = { + image = "reddit-grab"; + scale = 1; + }; + dpreview = { + image = "dpreview-grab"; + scale = 0; + }; + issuu = { + image = "issuu-grab"; + scale = 0; + }; + urls = { + image = "urls-grab"; + scale = 2; + }; + urlteam = { + image = "terroroftinytown-client-grab"; + scale = 2; + }; + mediafire = { + image = "mediafire-grab"; + scale = 1; + }; + github = { + image = "github-grab"; + scale = 1; + }; + lineblog = { + image = "lineblog-grab"; + scale = 0; + }; + banciyuan = { + image = "banciyuan-grab"; + scale = 0; + }; + wysp = { + image = "wysp-grab"; + scale = 0; + }; + xuite = { + image = "xuite-grab"; + scale = 0; + }; + gfycat = { + image = "gfycat-grab"; + scale = 0; + }; + skyblog = { + image = "skyblog-grab"; + scale = 0; + }; + zowa = { + image = "zowa-grab"; + scale = 0; + }; + blogger = { + image = "blogger-grab"; + scale = 0; + }; + vbox7 = { + image = "vbox7-grab"; + scale = 0; + }; + pastebin = { + image = "pastebin-grab"; + scale = 1; + }; + youtube = { + image = "youtube-grab"; + scale = 1; + }; + deviantart = { + image = "deviantart-grab"; + scale = 1; + }; + }; + container-spec = container: { + image = "atdr.meo.ws/archiveteam/${container}"; + extraOptions = [ + "--stop-signal=SIGINT" + "--stop-timeout=1800" + ]; + labels = { + "com.centurylinklabs.watchtower.enable" = "true"; + "com.centurylinklabs.watchtower.scope" = "archiveteam"; + }; + cmd = lib.splitString " " "--concurrent 6 AmAnd0"; + + }; +in +{ + virtualisation.oci-containers.containers = + (lib.rad-dev.createTemplatedContainers containers container-spec) + // { + archiveteam-watchtower = { + image = "containrrr/watchtower:latest"; + labels = { + "com.centurylinklabs.watchtower.enable" = "true"; + "com.centurylinklabs.watchtower.scope" = "archiveteam"; + }; + volumes = [ "/var/run/docker.sock:/var/run/docker.sock" ]; + cmd = lib.splitString " " "--label-enable --cleanup --interval 600"; + }; + }; +} diff --git a/systems/palatine-hill/docker/default.nix b/systems/palatine-hill/docker/default.nix new file mode 100644 index 0000000..55e3f0a --- /dev/null +++ b/systems/palatine-hill/docker/default.nix @@ -0,0 +1,12 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ./archiveteam.nix ]; + + virtualisation.oci-containers.backend = "docker"; +}