summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJustinas Stankevicius <justinas@justinas.org>2022-11-12 00:05:10 +0200
committerKerstin <kerstin@erictapen.name>2022-11-12 22:22:41 +0100
commit3f6eb10dbdff395a322c1b9f9167784096064278 (patch)
tree2a7d3fc6872c28cde3d637349b325f2a87813547 /nixos
parent702a4dd0e20b80aae468707f4873412be92b657a (diff)
nixos/mastodon: fix definition of mastodon-media-auto-remove
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/web-apps/mastodon.nix14
-rw-r--r--nixos/tests/web-apps/mastodon.nix3
2 files changed, 10 insertions, 7 deletions
diff --git a/nixos/modules/services/web-apps/mastodon.nix b/nixos/modules/services/web-apps/mastodon.nix
index 83890e969909c..d159d2ade0630 100644
--- a/nixos/modules/services/web-apps/mastodon.nix
+++ b/nixos/modules/services/web-apps/mastodon.nix
@@ -623,15 +623,15 @@ in {
       environment = env;
       serviceConfig = {
         Type = "oneshot";
-        script = let
-          olderThanDays = toString cfg.mediaAutoRemove.olderThanDays;
-        in ''
-          ${cfg.package}/bin/tootctl media remove --days=${olderThanDays}
-          ${cfg.package}/bin/tootctl preview_cards remove --days=${olderThanDays}
-        '';
         EnvironmentFile = "/var/lib/mastodon/.secrets_env";
-        startAt = cfg.mediaAutoRemove.startAt;
       } // cfgService;
+      script = let
+        olderThanDays = toString cfg.mediaAutoRemove.olderThanDays;
+      in ''
+        ${cfg.package}/bin/tootctl media remove --days=${olderThanDays}
+        ${cfg.package}/bin/tootctl preview_cards remove --days=${olderThanDays}
+      '';
+      startAt = cfg.mediaAutoRemove.startAt;
     };
 
     services.nginx = lib.mkIf cfg.configureNginx {
diff --git a/nixos/tests/web-apps/mastodon.nix b/nixos/tests/web-apps/mastodon.nix
index 279a1c59169fa..05cc727476d67 100644
--- a/nixos/tests/web-apps/mastodon.nix
+++ b/nixos/tests/web-apps/mastodon.nix
@@ -129,6 +129,9 @@ in
     ca.wait_for_unit("step-ca.service")
     ca.wait_for_open_port(8443)
 
+    # Check that mastodon-media-auto-remove is scheduled
+    server.succeed("systemctl status mastodon-media-auto-remove.timer")
+
     server.wait_for_unit("nginx.service")
     server.wait_for_unit("redis-mastodon.service")
     server.wait_for_unit("postgresql.service")