ctucx.git: nixfiles

ctucx' nixfiles

commit a230d49210c9947f259fd8e72938f2d47d520b2b
parent 427d87e7da9028569e75a356ba2f3037a1db7d38
Author: Leah (ctucx) <git@ctu.cx>
Date: Sun, 27 Nov 2022 16:34:25 +0100

machines/trabbi/pleroma: clean-up old posts every day
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/machines/trabbi/pleroma/default.nix b/machines/trabbi/pleroma/default.nix
@@ -13,8 +13,23 @@
 
   dns.zones."ctu.cx".subdomains.pleroma.CNAME = [ "${config.networking.fqdn}." ];
 
-  systemd.services.pleroma.path      = [ pkgs.exiftool ];
-  systemd.services.pleroma.onFailure = [ "email-notify@%i.service" ];
+  systemd.services = {
+    pleroma = {
+      path      = [ pkgs.exiftool ];
+      onFailure = [ "email-notify@%i.service" ];
+    };
+
+    pleroma-cleanup = {
+      startAt                    = "*-*-* 3:00:00";
+      path                       = with pkgs; [ gawk ];
+      onFailure                  = [ "email-notify@%i.service" ];
+      environment.RELEASE_COOKIE = "/var/lib/pleroma/.cookie";
+      serviceConfig.Type         = "oneshot";
+      serviceConfig.User         = config.services.pleroma.user;
+      serviceConfig.Group        = config.services.pleroma.group;
+      serviceConfig.ExecStart    = "${pkgs.pleroma}/bin/pleroma_ctl database prune_objects --vacuum";
+    };
+  };
 
   services = {
     postgresql = {