config.nix/modules/server/social/gotosocial.nix
2026-04-11 17:21:28 +02:00

64 lines
1.9 KiB
Nix

{
config,
pkgs,
inputs,
lib,
...
}:
{
options = {
server.social.gotosocial = {
enable = lib.mkEnableOption "enable gotosocial";
port = lib.mkOption {
default = 8008;
description = "gotosocial port";
};
public = lib.mkOption {
default = true;
description = "public gotosocial";
};
subdomain = lib.mkOption {
default = "fedi";
description = "gotosocial subdomain";
};
};
};
config = {
services = {
gotosocial = {
enable = config.server.social.gotosocial.enable;
settings = {
application_name = "The Martyverse";
host = "${config.server.social.gotosocial.subdomain}.${config.networking.domain}";
bind-address = "127.0.0.1";
port = config.server.social.gotosocial.port;
protocol = "https";
landing-page-user = "${config.user.userName}";
db-address = "/home/${config.user.userName}/gotosocial/storage/sqlite.db";
storage-local-base-path = "/home/${config.user.userName}/gotosocial/storage";
db-type = "sqlite";
accounts-allow-custom-css = true;
accounts-registration-open = true;
accounts-reason-required = true;
accounts-registration-backlog-limit = 20;
};
};
nginx = {
virtualHosts = {
"${config.server.social.gotosocial.subdomain}.${config.networking.domain}" =
if config.server.social.gotosocial.public && config.server.social.gotosocial.enable then
{
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString config.server.social.gotosocial.port}";
proxyWebsockets = true;
};
}
else
{ };
};
};
};
};
}