Allow server to be imported, deprioritize Jimbo. Those who nose.

This commit is contained in:
Jimbo 2025-01-01 02:02:00 -05:00
parent 5f0edcbb09
commit d873588c59
42 changed files with 228 additions and 207 deletions

View file

@ -1,41 +1,43 @@
{ config, ... }:
{ config, lib, ... }:
{
imports = [ ./nginx ];
services = {
coturn = {
enable = true;
no-cli = true;
no-tcp-relay = true;
min-port = 49000;
max-port = 50000;
use-auth-secret = true;
static-auth-secret = config.secrets.coturnSecret;
realm = "turn.${config.domains.jim1}";
cert = "/var/lib/acme/turn.${config.domains.jim1}.com/fullchain.pem";
pkey = "/var/lib/acme/turn.${config.domains.jim1}.com/key.pem";
config = lib.mkIf config.services.matrix-synapse.enable {
services = {
coturn = {
enable = true;
no-cli = true;
no-tcp-relay = true;
min-port = 49000;
max-port = 50000;
use-auth-secret = true;
static-auth-secret = config.secrets.coturnSecret;
realm = "turn.${config.domains.p1}";
cert = "/var/lib/acme/turn.${config.domains.p1}.com/fullchain.pem";
pkey = "/var/lib/acme/turn.${config.domains.p1}.com/key.pem";
};
# Enable coturn on Synapse
matrix-synapse.settings = {
turn_uris = [
"turn:turn.${config.domains.p1}:3478?transport=udp"
"turn:turn.${config.domains.p1}:3478?transport=tcp"
];
turn_shared_secret = config.secrets.coturnSecret;
turn_user_lifetime = "1h";
};
};
# Enable coturn on Synapse
matrix-synapse.settings = {
turn_uris = [
"turn:turn.${config.domains.jim1}:3478?transport=udp"
"turn:turn.${config.domains.jim1}:3478?transport=tcp"
# Open coturn ports
networking.firewall = {
allowedUDPPorts = [
3478
5349
];
turn_shared_secret = config.secrets.coturnSecret;
turn_user_lifetime = "1h";
allowedUDPPortRanges = [{
from = config.services.coturn.min-port;
to = config.services.coturn.max-port;
}];
};
};
# Open coturn ports
networking.firewall = {
allowedUDPPorts = [
3478
5349
];
allowedUDPPortRanges = [{
from = config.services.coturn.min-port;
to = config.services.coturn.max-port;
}];
};
}

View file

@ -1,20 +1,22 @@
{ config, ... }:
{ config, lib, ... }:
{
services.nginx.virtualHosts."turn.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
listen = [{
addr = "0.0.0.0";
port = 80;
ssl = false;
}];
locations."/".proxyPass = "http://127.0.0.1:1380";
};
config = lib.mkIf config.services.coturn.enable {
services.nginx.virtualHosts."turn.${config.domains.p1}" = {
enableACME = true;
forceSSL = true;
listen = [{
addr = "0.0.0.0";
port = 80;
ssl = false;
}];
locations."/".proxyPass = "http://127.0.0.1:1380";
};
security.acme.certs = {
"turn.${config.domains.jim1}" = {
group = "turnserver";
postRun = "systemctl restart coturn.service";
security.acme.certs = {
"turn.${config.domains.p1}" = {
group = "turnserver";
postRun = "systemctl restart coturn.service";
};
};
};
}

View file

@ -3,7 +3,6 @@
imports = [
./coturn
./element
./slidingsync
./synapse
];
}

View file

@ -1,21 +1,23 @@
{ config, ... }:
{ config, lib, ... }:
{
imports = [ ./nginx ];
nixpkgs.config.element-web.conf = {
default_server_config."m.homeserver" = {
base_url = "https://matrix.${config.domains.jim1}";
server_name = "matrix.${config.domains.jim1}";
config = lib.mkIf config.services.matrix-synapse.enable {
nixpkgs.config.element-web.conf = {
default_server_config."m.homeserver" = {
base_url = "https://matrix.${config.domains.p1}";
server_name = "matrix.${config.domains.p1}";
};
branding = {
#welcome_background_url = "https://staging.${config.domains.p1}/images/backgrounds/template-background.png";
#auth_header_logo_url = "https://staging.${config.domains.p1}/images/logos/template-logo.png";
};
embedded_pages = {
home_url = "https://www.${config.domains.p1}/";
};
disable_custom_urls = true;
disable_guests = true;
default_theme = "dark";
};
branding = {
#welcome_background_url = "https://staging.${config.domains.jim1}/images/backgrounds/template-background.png";
#auth_header_logo_url = "https://staging.${config.domains.jim1}/images/logos/template-logo.png";
};
embedded_pages = {
home_url = "https://www.${config.domains.jim1}/";
};
disable_custom_urls = true;
disable_guests = true;
default_theme = "dark";
};
}

View file

@ -1,6 +1,6 @@
{ pkgs, config, ... }:
{ pkgs, config, lib, ... }:
{
services.nginx.virtualHosts."chat.${config.domains.jim1}" = {
services.nginx.virtualHosts."chat.${config.domains.p1}" = lib.mkIf config.services.matrix-synapse.enable {
enableACME = true;
addSSL = true;
root = "${pkgs.element-web}";

View file

@ -1,13 +0,0 @@
{ pkgs, config, ... }:
{
services.matrix-sliding-sync = {
enable = true;
settings = {
SYNCV3_SERVER = "https://matrix.${config.domains.jim1}";
SYNCV3_BINDADDR = "0.0.0.0:8009";
};
environmentFile = pkgs.writeText "matrixsecret" ''
SYNCV3_SECRET=${config.secrets.matrixSecret}
'';
};
}

View file

@ -1,10 +1,10 @@
{ pkgs, config, ... }:
{
services.matrix-synapse = {
enable = true;
enable = config.system.server.enable;
settings = {
server_name = "${config.domains.jim1}";
public_baseurl = "https://matrix.${config.domains.jim1}";
server_name = "${config.domains.p1}";
public_baseurl = "https://matrix.${config.domains.p1}";
suppress_key_server_warning = true;
listeners = [
@ -19,9 +19,9 @@
];
email = {
notif_from = "Jimbo's Matrix <noreply@${config.domains.jim1}>";
smtp_host = "mx.${config.domains.jim1}";
smtp_user = "noreply@${config.domains.jim1}";
notif_from = "Jimbo's Matrix <noreply@${config.domains.p1}>";
smtp_host = "mx.${config.domains.p1}";
smtp_user = "noreply@${config.domains.p1}";
smtp_pass = config.secrets.noreplyPassword;
enable_tls = true;
smtp_port = 587;

View file

@ -1,6 +1,6 @@
{ config, ... }:
{
services.nginx.virtualHosts."matrix.${config.domains.jim1}" = {
services.nginx.virtualHosts."matrix.${config.domains.p1}" = {
enableACME = true;
forceSSL = true;
locations = {