dotfiles/nixos/boxes/vpsfree1/mastodon.nix

41 lines
956 B
Nix
Raw Normal View History

2023-08-13 17:00:41 +01:00
{
config,
pkgs,
inputs,
lib,
...
}: let
2023-07-07 07:00:12 +01:00
newestPackages = inputs.nixpkgs-master.legacyPackages.${pkgs.system};
package = newestPackages.mastodon;
2022-11-26 11:10:35 +00:00
domain = "peninsula.industries";
streamingPort = 55000;
webPort = 55001;
path = "/var/lib/mastodon/";
2022-11-26 21:54:48 +00:00
publicPath = "${path}/public-system/";
2022-11-26 11:10:35 +00:00
in {
2023-08-13 17:00:41 +01:00
imports = [../nginx.nix];
2023-07-06 22:41:43 +01:00
system.stateVersion = "23.05";
2022-11-26 11:10:35 +00:00
services.nginx = {
virtualHosts = {
"${domain}" = {
forceSSL = true;
enableACME = true;
root = "${package}/public/";
2022-11-26 11:10:35 +00:00
2023-08-13 17:00:41 +01:00
locations."/" = {tryFiles = "$uri @proxy";};
2022-11-26 21:54:48 +00:00
locations."/system/".alias = "${publicPath}";
2022-11-26 11:10:35 +00:00
locations."@proxy" = {
proxyPass = "http://127.0.0.1:" + toString webPort;
2022-11-26 11:10:35 +00:00
proxyWebsockets = true;
};
locations."/api/v1/streaming/" = {
proxyPass = "http://127.0.0.1:" + toString streamingPort;
2022-11-26 11:10:35 +00:00
proxyWebsockets = true;
};
};
};
};
}