summaryrefslogtreecommitdiff
path: root/modules/webapps/mastodon.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webapps/mastodon.nix')
-rw-r--r--modules/webapps/mastodon.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/webapps/mastodon.nix b/modules/webapps/mastodon.nix
index 26d5238f..eed9e3f6 100644
--- a/modules/webapps/mastodon.nix
+++ b/modules/webapps/mastodon.nix
@@ -190,6 +190,36 @@ in
190 unitConfig.RequiresMountsFor = cfg.dataDir; 190 unitConfig.RequiresMountsFor = cfg.dataDir;
191 }; 191 };
192 192
193 systemd.services.mastodon-cleanup = {
194 description = "Cleanup mastodon";
195 startAt = "daily";
196 restartIfChanged = false;
197
198 environment.RAILS_ENV = "production";
199 environment.BUNDLE_PATH = "${cfg.workdir.gems}/${cfg.workdir.gems.ruby.gemPath}";
200 environment.BUNDLE_GEMFILE = "${cfg.workdir.gems.confFiles}/Gemfile";
201 environment.SOCKET = cfg.sockets.rails;
202
203 path = [ cfg.workdir.gems cfg.workdir.gems.ruby pkgs.file ];
204
205 script = ''
206 exec ./bin/tootctl media remove --days 30
207 '';
208
209 serviceConfig = {
210 User = cfg.user;
211 EnvironmentFile = cfg.configFile;
212 PrivateTmp = true;
213 Type = "oneshot";
214 WorkingDirectory = cfg.workdir;
215 StateDirectory = cfg.systemdStateDirectory;
216 RuntimeDirectory = cfg.systemdRuntimeDirectory;
217 RuntimeDirectoryPreserve = "yes";
218 };
219
220 unitConfig.RequiresMountsFor = cfg.dataDir;
221 };
222
193 systemd.services.mastodon-sidekiq = { 223 systemd.services.mastodon-sidekiq = {
194 description = "Mastodon Sidekiq"; 224 description = "Mastodon Sidekiq";
195 wantedBy = [ "multi-user.target" ]; 225 wantedBy = [ "multi-user.target" ];