commit f27901e0374d379d125621a713160ddc41868976
parent d7ac4d473886fb497f620f967b6043bb9ecbf334
Author: Leah (ctucx) <git@ctu.cx>
Date: Thu, 23 Feb 2023 16:53:57 +0100
parent d7ac4d473886fb497f620f967b6043bb9ecbf334
Author: Leah (ctucx) <git@ctu.cx>
Date: Thu, 23 Feb 2023 16:53:57 +0100
machines/lollo/gotosocial: serve static assets from nginx
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/machines/lollo/gotosocial.nix b/machines/lollo/gotosocial.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ pkgs, lib, config, ... }: let gotosocial = pkgs.callPackage ../../pkgs/gotosocial-bin.nix {}; @@ -18,9 +18,12 @@ in { ''; }; + systemd.services.gotosocial.serviceConfig.Group = lib.mkForce config.services.nginx.group; + services.gotosocial = { enable = true; package = gotosocial; + group = "nginx"; settings = { application-name = "ctucx.gts"; @@ -39,7 +42,9 @@ in { accounts-allow-custom-css = true; accounts-registration-open = false; - instance-expose-peers = true; + instance-expose-peers = true; + instance-expose-suspended = true; + instance-expose-suspended-web = true; storage-backend = "local"; storage-local-base-path = "/var/lib/gotosocial/storage"; @@ -56,6 +61,21 @@ in { locations = { "/.well-known/host-meta".extraConfig = ''return 200 '<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="https://fedi.home.ctu.cx/.well-known/webfinger?resource={uri}" type="application/xrd+xml" /></XRD>';''; "= /".return = "307 /@leah"; + + "/assets/".extraConfig = '' + alias ${config.services.gotosocial.package}/share/web/assets/; + autoindex off; + expires max; + add_header Cache-Control "public, immutable"; + ''; + + # "/fileserver/".extraConfig = '' + # alias ${config.services.gotosocial.settings.storage-local-base-path}/; + # autoindex off; + # expires max; + # add_header Cache-Control "public, immutable"; + # ''; + "/".extraConfig = '' proxy_pass http://localhost:8085/;
diff --git a/modules/linux/gotosocial.nix b/modules/linux/gotosocial.nix @@ -123,7 +123,7 @@ in { StateDirectory = lib.mkIf (cfg.settings.storage-local-base-path != "/var/lib/gotosocial") "gotosocial"; ReadOnlyPaths = [ cfg.package ]; ReadWritePaths = [ cfg.settings.storage-local-base-path ]; - StateDirectoryMode = "700"; + StateDirectoryMode = "750"; Restart = "always"; RestartSec = 3;