Files
system-config/system/hosts/mcp/containers/havenisms.com/chat-beta.nix
T

57 lines
1.9 KiB
Nix

{ config, ... }:
let
inherit (import ../lib.nix config) havenisms;
matrixHost = "matrix";
serviceName = "matrix-havenisms-com";
dbPath = "/var/lib/matrix";
port = 8448;
in
{
sops.secrets = {
"matrix/${serviceName}/registration-token" = {
restartUnits = [ "${config.local.container-backend}-${serviceName}.service" ];
};
};
sops.templates."${serviceName}.env".content = ''
CONTINUWUITY_REGISTRATION_TOKEN=${
config.sops.placeholder."matrix/${serviceName}/registration-token"
}
CONTINUWUITY_ADDRESS=0.0.0.0
CONTINUWUITY_SERVER_NAME=havenisms.com
CONTINUWUITY_ALLOW_REGISTRATION=false
CONTINUWUITY_ALLOW_CHECK_FOR_UPDATES=true
CONTINUWUITY_ALLOW_FEDERATION=true
CONTINUWUITY_DATABASE_BACKEND=rocksdb
CONTINUWUITY_DATABASE_PATH=${dbPath}
CONTINUWUITY_WELL_KNOWN={ server=${matrixHost}.havenisms.com:443 }
CONTINUWUITY_TRUSTED_SERVERS=["matrix.org", "chat.havenisms.com", "matrix.blazestar.net"]
'';
# This isn't using any of my usual helpers because I wanted to set a custom
# serviceName in Traefik that is different from the hostname
virtualisation.web-containers.containers."${serviceName}" = {
image = "forgejo.ellis.link/continuwuation/continuwuity:latest";
port = port;
hostname = matrixHost;
domain = havenisms;
volumes = [
"/tank/matrix/home:${dbPath}"
];
environment = {
CONTINUWUITY_PORT = toString port;
};
environmentFiles = [
config.sops.templates."${serviceName}.env".path
];
extraLabels = {
# Redirect well-known requests to this host.
"traefik.http.routers.${serviceName}-well-known.rule" =
"Host(`${havenisms}`) && PathPrefix(`/.well-known/matrix`)";
"traefik.http.routers.${serviceName}-well-known.service" = serviceName;
# Increase the priority so that this will override other routers for the host.
"traefik.http.routers.${serviceName}-well-known.priority" = "1000";
};
};
}