Camelot: add GoToSocial instance

This commit is contained in:
Victor Mignot 2024-07-06 09:23:24 +02:00
parent 22c0117beb
commit 1d00aacc8b
Signed by: dala
GPG key ID: 5E7F2CE1BEAFED3D
3 changed files with 60 additions and 2 deletions

View file

@ -42,13 +42,23 @@
./jellyfin.nix ./jellyfin.nix
./wireguard.nix ./wireguard.nix
./nextcloud.nix ./nextcloud.nix
./gotosocial.nix
]; ];
swapDeviceUUID = "a7c628ab-c5cb-4094-89d0-19b153fbead4"; swapDeviceUUID = "a7c628ab-c5cb-4094-89d0-19b153fbead4";
server.networking.enableSSH = true; server.networking.enableSSH = true;
services.nginx.enable = true; services.nginx = {
enable = true;
clientMaxBodySize = "40m";
virtualHosts."dalaran.fr" = {
default = true;
enableACME = true;
forceSSL = true;
};
};
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
neovim neovim

View file

@ -0,0 +1,47 @@
{ config, ... }:
let
wellKnownLocations = [
"/.well-known/webfinger"
"/.well-known/host-meta"
"/.well-known/nodeinfo"
];
gtsConfig = config.services.gotosocial.settings;
in
{
services.gotosocial = {
enable = true;
openFirewall = true;
setupPostgresqlDB = true;
settings = {
applications-name = "Dala's personnal instance";
host = "gts.dalaran.fr";
account-domain = "dalaran.fr";
bind-address = "localhost";
};
};
services.nginx.virtualHosts = {
"dalaran.fr".locations = builtins.listToAttrs (
map (location: {
name = location;
value.return = "301 https://gts.dalaran.fr$request_uri";
}) wellKnownLocations
);
"gts.dalaran.fr" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://${gtsConfig.bind-address}:${builtins.toString gtsConfig.port}";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
'';
};
};
};
}

View file

@ -2,7 +2,8 @@
with lib; with lib;
let let
host = extraInfo.woodpeckerURI; host = extraInfo.woodpeckerURI;
in { in
{
options.server.build.enable = mkOption { options.server.build.enable = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;