diff options
| -rw-r--r-- | krebs/2configs/mastodon.nix | 31 | 
1 files changed, 23 insertions, 8 deletions
| diff --git a/krebs/2configs/mastodon.nix b/krebs/2configs/mastodon.nix index 723e2c385..3c7205167 100644 --- a/krebs/2configs/mastodon.nix +++ b/krebs/2configs/mastodon.nix @@ -1,4 +1,14 @@  { config, lib, pkgs, ... }: +let +  mastodon-clear-cache = pkgs.writers.writeDashBin "mastodon-clear-cache" '' +    /run/current-system/sw/bin/mastodon-tootctl media remove --prune-profiles --days=14 --concurrency=30 +    /run/current-system/sw/bin/mastodon-tootctl media remove-orphans +    /run/current-system/sw/bin/mastodon-tootctl preview_cards remove --days=14 +    /run/current-system/sw/bin/mastodon-tootctl accounts prune +    /run/current-system/sw/bin/mastodon-tootctl statuses remove --days 4 +    /run/current-system/sw/bin/mastodon-tootctl media remove --days 4 +  ''; +in  {    services.postgresql = {      enable = true; @@ -25,15 +35,20 @@      443    ]; +  systemd.services.mastodon-clear-cache = { +    description = "Mastodon Clear Cache"; +    wantedBy = [ "timers.target" ]; +    startAt = "daily"; +    serviceConfig = { +      Type = "oneshot"; +      ExecStart = "${mastodon-clear-cache}/bin/mastodon-clear-cache"; +      User = "mastodon"; +      WorkingDirectory = "/var/lib/mastodon"; +    }; +  }; +    environment.systemPackages = [ -    (pkgs.writers.writeDashBin "mastodon-clear-cache" '' -      mastodon-tootctl media remove --prune-profiles --days=14 --concurrency=30 -      mastodon-tootctl media remove-orphans -      mastodon-tootctl preview_cards remove --days=14 -      mastodon-tootctl accounts prune -      mastodon-tootctl statuses remove --days 4 -      mastodon-tootctl media remove --days 4 -    '') +    mastodon-clear-cache      (pkgs.writers.writeDashBin "create-mastodon-user" ''        set -efu        nick=$1 | 
