dotfiles/nixos/boxes/vpsfree1/mastodon.nix

41 lines
956 B
Nix

{
config,
pkgs,
inputs,
lib,
...
}: let
newestPackages = inputs.nixpkgs-master.legacyPackages.${pkgs.system};
package = newestPackages.mastodon;
domain = "peninsula.industries";
streamingPort = 55000;
webPort = 55001;
path = "/var/lib/mastodon/";
publicPath = "${path}/public-system/";
in {
imports = [../nginx.nix];
system.stateVersion = "23.05";
services.nginx = {
virtualHosts = {
"${domain}" = {
forceSSL = true;
enableACME = true;
root = "${package}/public/";
locations."/" = {tryFiles = "$uri @proxy";};
locations."/system/".alias = "${publicPath}";
locations."@proxy" = {
proxyPass = "http://127.0.0.1:" + toString webPort;
proxyWebsockets = true;
};
locations."/api/v1/streaming/" = {
proxyPass = "http://127.0.0.1:" + toString streamingPort;
proxyWebsockets = true;
};
};
};
};
}