From 4167d15a6d64bd1f858e7df798447e2588d6adce Mon Sep 17 00:00:00 2001 From: Victor Date: Sat, 29 Apr 2023 23:51:59 +0200 Subject: [PATCH] media auto remove --- nixos/hosts/hades/mastodon/configuration.nix | 37 ++++---------------- nixos/hosts/olympus/nginx/configuration.nix | 1 - 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/nixos/hosts/hades/mastodon/configuration.nix b/nixos/hosts/hades/mastodon/configuration.nix index 38a81d0..e5a0131 100644 --- a/nixos/hosts/hades/mastodon/configuration.nix +++ b/nixos/hosts/hades/mastodon/configuration.nix @@ -37,7 +37,12 @@ in { webPort = 55001; enableUnixSocket = false; localDomain = "xirion.net"; - trustedProxy = "192.168.0.123"; + trustedProxy = "192.168.0.122"; + mediaAutoRemove = { + enable = true; + olderThanDays = 30; + startAt = "weekly"; + }; configureNginx = false; @@ -78,8 +83,7 @@ in { SMTP_AUTH_METHOD = "plain"; SMTP_OPENSSL_VERIFY_MODE = "none"; - # TODO: Don't? - RAILS_SERVE_STATIC_FILES = "true"; + RAILS_SERVE_STATIC_FILES = "false"; AUTHORIZED_FETCH = "true"; @@ -95,33 +99,6 @@ in { }; }; - # https://github.com/NixOS/nixpkgs/issues/116418#issuecomment-799517120 - systemd.services.mastodon-media-prune = let cfg = config.services.mastodon; - in { - description = "Mastodon media prune"; - environment = lib.filterAttrs (n: _: n != "PATH") - config.systemd.services.mastodon-web.environment; - serviceConfig = { - Type = "oneshot"; - # Remove remote media attachments older than one month. - ExecStart = "${cfg.package}/bin/tootctl media remove --days=30"; - User = cfg.user; - Group = cfg.group; - EnvironmentFile = "/var/lib/mastodon/.secrets_env"; - PrivateTmp = true; - }; - }; - - systemd.timers.mastodon-media-prune = { - description = "Mastodon media prune"; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnCalendar = "*-*-* 00:00:00"; # every day - Unit = "mastodon-media-prune.service"; - AccuracySec = "60s"; - }; - }; - networking.firewall = let cfg = config.services.mastodon; in { allowedTCPPorts = [ cfg.streamingPort cfg.webPort ]; }; } diff --git a/nixos/hosts/olympus/nginx/configuration.nix b/nixos/hosts/olympus/nginx/configuration.nix index 3901ff2..1a05a8c 100644 --- a/nixos/hosts/olympus/nginx/configuration.nix +++ b/nixos/hosts/olympus/nginx/configuration.nix @@ -80,7 +80,6 @@ in { enableACME = true; forceSSL = true; locations."/".extraConfig = '' - add_header Content-Type 'text/html; charset=UTF-8'; return 200 '

meow

'; '';