Add mastodon (work in progress)
This commit is contained in:
parent
d30cba946f
commit
55f57ddd26
2 changed files with 85 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
{
|
||||
imports = [
|
||||
./homepage
|
||||
./mastodon.nix
|
||||
./samba.nix
|
||||
./uptime-kuma.nix
|
||||
./vaultwarden.nix
|
||||
|
|
84
hosts/nixedo/services/mastodon.nix
Normal file
84
hosts/nixedo/services/mastodon.nix
Normal file
|
@ -0,0 +1,84 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.homelab.services.${service};
|
||||
domain = "oliverdavies.uk";
|
||||
service = "mastodon";
|
||||
in
|
||||
{
|
||||
options.homelab.services.${service} = {
|
||||
url = mkOption {
|
||||
default = "social.${domain}";
|
||||
internal = true;
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
services = {
|
||||
${service} = {
|
||||
enable = false;
|
||||
|
||||
configureNginx = false;
|
||||
localDomain = domain;
|
||||
streamingProcesses = 3;
|
||||
|
||||
extraConfig = {
|
||||
SINGLE_USER_MODE = "true";
|
||||
WEB_DOMAIN = cfg.url;
|
||||
};
|
||||
|
||||
smtp = {
|
||||
fromAddress = "social@${domain}";
|
||||
};
|
||||
};
|
||||
|
||||
cloudflared.tunnels.${config.homelab.cloudflared.tunnelId} = {
|
||||
ingress = {
|
||||
"${cfg.url}" = "http://localhost";
|
||||
};
|
||||
};
|
||||
|
||||
nginx = {
|
||||
upstreams.mastodon-streaming = {
|
||||
extraConfig = ''
|
||||
least_conn;
|
||||
'';
|
||||
|
||||
servers = builtins.listToAttrs (
|
||||
map (i: {
|
||||
name = "unix:/run/mastodon-streaming/streaming-${toString i}.socket";
|
||||
value = { };
|
||||
}) (range 1 config.services.mastodon.streamingProcesses)
|
||||
);
|
||||
};
|
||||
|
||||
virtualHosts."social.oliverdavies.uk" = {
|
||||
root = "${config.services.mastodon.package}/public/";
|
||||
|
||||
locations = {
|
||||
"/".tryFiles = "$uri @proxy";
|
||||
|
||||
"/api/v1/streaming/" = {
|
||||
proxyPass = "http://mastodon-streaming";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
|
||||
"/system/".alias = "/var/lib/mastodon/public-system/";
|
||||
|
||||
"@proxy" = {
|
||||
proxyPass = "http://unix:/run/mastodon-web/web.socket";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = ''
|
||||
client_max_body_size 100m;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue