set services to default retooling
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
<<<<<<< HEAD
|
||||
{
|
||||
lib.mkIf config.sovran_systemsOS.services.synapse {
|
||||
|
||||
# ── PostgreSQL database for Matrix ──────────────────────────
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
@@ -27,6 +27,8 @@
|
||||
};
|
||||
path = [ config.services.postgresql.package pkgs.pwgen pkgs.coreutils ];
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
|
||||
SECRET_DIR="/var/lib/secrets"
|
||||
SECRET_FILE="$SECRET_DIR/matrix_db_secret"
|
||||
|
||||
@@ -48,7 +50,7 @@
|
||||
'';
|
||||
};
|
||||
|
||||
# ── Generate Synapse runtime config from /var/lib/domains ───
|
||||
# ── Generate Synapse runtime config from domain files ───────
|
||||
systemd.services.matrix-synapse-runtime-config = {
|
||||
description = "Generate Matrix Synapse runtime config from domain files";
|
||||
before = [ "matrix-synapse.service" ];
|
||||
@@ -61,13 +63,27 @@
|
||||
};
|
||||
path = [ pkgs.coreutils ];
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
|
||||
MATRIX=$(cat /var/lib/domains/matrix)
|
||||
RUNTIME_DIR="/run/matrix-synapse"
|
||||
mkdir -p "$RUNTIME_DIR"
|
||||
|
||||
cat > "$RUNTIME_DIR/runtime-config.yaml" <<EOF
|
||||
server_name: "$MATRIX"
|
||||
EOF
|
||||
# Include TURN config if coturn secret exists (deployed machines)
|
||||
if [ -f /var/lib/secrets/coturn_static_auth_secret ]; then
|
||||
COTURN_SECRET=$(cat /var/lib/secrets/coturn_static_auth_secret)
|
||||
cat > "$RUNTIME_DIR/runtime-config.yaml" <<EOF
|
||||
server_name: "$MATRIX"
|
||||
turn_shared_secret: "$COTURN_SECRET"
|
||||
turn_uris:
|
||||
- "turn:$MATRIX:5349?transport=udp"
|
||||
- "turn:$MATRIX:5349?transport=tcp"
|
||||
EOF
|
||||
else
|
||||
cat > "$RUNTIME_DIR/runtime-config.yaml" <<EOF
|
||||
server_name: "$MATRIX"
|
||||
EOF
|
||||
fi
|
||||
|
||||
chown matrix-synapse:matrix-synapse "$RUNTIME_DIR/runtime-config.yaml"
|
||||
chmod 640 "$RUNTIME_DIR/runtime-config.yaml"
|
||||
@@ -75,135 +91,55 @@
|
||||
};
|
||||
|
||||
# ── Synapse service ─────────────────────────────────────────
|
||||
lib.mkIf config.sovran_systemsOS.features.synapse {
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
extraConfigFiles = [ "/run/matrix-synapse/runtime-config.yaml" ];
|
||||
settings = {
|
||||
push.include_content = false;
|
||||
group_unread_count_by_room = false;
|
||||
encryption_enabled_by_default_for_room_type = "invite";
|
||||
allow_profile_lookup_over_federation = false;
|
||||
allow_device_name_lookup_over_federation = false;
|
||||
# server_name is injected at runtime via extraConfigFiles
|
||||
url_preview_enabled = true;
|
||||
max_upload_size = "1024M";
|
||||
url_preview_ip_range_blacklist = [
|
||||
"10.0.0.0/8"
|
||||
"100.64.0.0/10"
|
||||
"169.254.0.0/16"
|
||||
"172.16.0.0/12"
|
||||
"192.0.0.0/24"
|
||||
"192.0.2.0/24"
|
||||
"192.168.0.0/16"
|
||||
"192.88.99.0/24"
|
||||
"198.18.0.0/15"
|
||||
"198.51.100.0/24"
|
||||
"2001:db8::/32"
|
||||
"203.0.113.0/24"
|
||||
"224.0.0.0/4"
|
||||
"::1/128"
|
||||
"fc00::/7"
|
||||
"fe80::/10"
|
||||
"fec0::/10"
|
||||
"ff00::/8"
|
||||
];
|
||||
url_preview_ip_ranger_whitelist = [ "127.0.0.1" ];
|
||||
presence.enabled = true;
|
||||
enable_registration = false;
|
||||
registration_shared_secret = config.age.secrets.matrix_reg_secret.path;
|
||||
listeners = [
|
||||
{
|
||||
port = 8008;
|
||||
bind_addresses = [ "::1" ];
|
||||
type = "http";
|
||||
tls = false;
|
||||
x_forwarded = true;
|
||||
resources = [
|
||||
{
|
||||
names = [ "client" ];
|
||||
compress = true;
|
||||
}
|
||||
{
|
||||
names = [ "federation" ];
|
||||
compress = false;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
extraConfigFiles = [ "/run/matrix-synapse/runtime-config.yaml" ];
|
||||
settings = {
|
||||
# server_name, turn_shared_secret, turn_uris injected at runtime
|
||||
push.include_content = false;
|
||||
group_unread_count_by_room = false;
|
||||
encryption_enabled_by_default_for_room_type = "invite";
|
||||
allow_profile_lookup_over_federation = false;
|
||||
allow_device_name_lookup_over_federation = false;
|
||||
url_preview_enabled = true;
|
||||
max_upload_size = "1024M";
|
||||
url_preview_ip_range_blacklist = [
|
||||
"10.0.0.0/8"
|
||||
"100.64.0.0/10"
|
||||
"169.254.0.0/16"
|
||||
"172.16.0.0/12"
|
||||
"192.0.0.0/24"
|
||||
"192.0.2.0/24"
|
||||
"192.168.0.0/16"
|
||||
"192.88.99.0/24"
|
||||
"198.18.0.0/15"
|
||||
"198.51.100.0/24"
|
||||
"2001:db8::/32"
|
||||
"203.0.113.0/24"
|
||||
"224.0.0.0/4"
|
||||
"::1/128"
|
||||
"fc00::/7"
|
||||
"fe80::/10"
|
||||
"fec0::/10"
|
||||
"ff00::/8"
|
||||
];
|
||||
url_preview_ip_ranger_whitelist = [ "127.0.0.1" ];
|
||||
presence.enabled = true;
|
||||
enable_registration = false;
|
||||
registration_shared_secret = config.age.secrets.matrix_reg_secret.path;
|
||||
listeners = [
|
||||
{
|
||||
port = 8008;
|
||||
bind_addresses = [ "::1" ];
|
||||
type = "http";
|
||||
tls = false;
|
||||
x_forwarded = true;
|
||||
resources = [
|
||||
{ names = [ "client" ]; compress = true; }
|
||||
{ names = [ "federation" ]; compress = false; }
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
=======
|
||||
|
||||
####### CREATE NEW USER (ADMIN OR NOT) VIA TERMINAL #######
|
||||
|
||||
# (Run as root in terminal) matrix-synapse-register_new_matrix_user #
|
||||
|
||||
####### #######
|
||||
|
||||
let
|
||||
personalization = import ./personalization.nix;
|
||||
in
|
||||
lib.mkIf config.sovran_systemsOS.features.synapse {
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
settings = {
|
||||
push.include_content = false;
|
||||
group_unread_count_by_room = false;
|
||||
encryption_enabled_by_default_for_room_type = "invite";
|
||||
allow_profile_lookup_over_federation = false;
|
||||
allow_device_name_lookup_over_federation = false;
|
||||
server_name = personalization.matrix_url;
|
||||
url_preview_enabled = true;
|
||||
max_upload_size = "1024M";
|
||||
url_preview_ip_range_blacklist = [
|
||||
"10.0.0.0/8"
|
||||
"100.64.0.0/10"
|
||||
"169.254.0.0/16"
|
||||
"172.16.0.0/12"
|
||||
"192.0.0.0/24"
|
||||
"192.0.2.0/24"
|
||||
"192.168.0.0/16"
|
||||
"192.88.99.0/24"
|
||||
"198.18.0.0/15"
|
||||
"198.51.100.0/24"
|
||||
"2001:db8::/32"
|
||||
"203.0.113.0/24"
|
||||
"224.0.0.0/4"
|
||||
"::1/128"
|
||||
"fc00::/7"
|
||||
"fe80::/10"
|
||||
"fec0::/10"
|
||||
"ff00::/8"
|
||||
];
|
||||
url_preview_ip_ranger_whitelist = [ "127.0.0.1" ];
|
||||
turn_shared_secret = "${personalization.coturn_static_auth_secret}";
|
||||
turn_uris = [
|
||||
"turn:${personalization.matrix_url}:5349?transport=udp"
|
||||
"turn:${personalization.matrix_url}:5349?transport=tcp"
|
||||
];
|
||||
presence.enabled = true;
|
||||
enable_registration = false;
|
||||
registration_shared_secret = config.age.secrets.matrix_reg_secret.path;
|
||||
listeners = [
|
||||
{
|
||||
port = 8008;
|
||||
bind_addresses = [ "::1" ];
|
||||
type = "http";
|
||||
tls = false;
|
||||
x_forwarded = true;
|
||||
resources = [ {
|
||||
names = [ "client" ];
|
||||
compress = true;
|
||||
}
|
||||
{
|
||||
names = [ "federation" ];
|
||||
compress = false;
|
||||
} ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
>>>>>>> 5bee5ad99bb7890df011d88e9928b6944c3565f8
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user