add matrix via DNS entries

This commit is contained in:
Ingolf Wagner 2024-04-03 23:35:26 +02:00
parent b1e4eb8576
commit 02b28f485a
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B

View file

@ -1,13 +1,13 @@
{ config, pkgs, ... }:
let
# 1. create DNS entry `_matrix._tcp.ingolf-wagner.de SRV - 10 8443 matrix.ingolf-wagner.de` (8443 for federation)
# 1. create DNS entry `_matrix._tcp.ingolf-wagner.de SRV - 10 8448 matrix.ingolf-wagner.de` (8448 for federation)
# 2. create DNS entry `matrix.ingolf-wagner.de A - 95.216.66.212`
# 3. test with : https://federationtester.matrix.org/#ingolf-wagner.de
# 4. info at : https://silvio.github.io/docker-matrix/Example.configs.html
domain = "ingolf-wagner.de";
baseUrl = "https://matrix.${domain}";
add_user_script = pkgs.writers.writeBashBin "matrix-create-user" ''
matrix_create_user = pkgs.writers.writeBashBin "matrix-create-user" ''
${pkgs.matrix-synapse}/bin/register_new_matrix_user \
-k $( ${pkgs.gojq}/bin/gojq \
--yaml-input \
@ -39,10 +39,10 @@ let
in
{
networking.firewall.allowedTCPPorts = [ 80 443 8443 ];
networking.firewall.allowedUDPPorts = [ 80 443 8443 ];
networking.firewall.allowedTCPPorts = [ 80 443 8448 ];
networking.firewall.allowedUDPPorts = [ 80 443 8448 ];
environment.systemPackages = [ add_user_script ];
environment.systemPackages = [ matrix_create_user ];
sops.secrets.matrix_shared_secret.owner = "matrix-synapse";
users.users.matrix-synapse = {
@ -162,7 +162,7 @@ in
# for federation
{
addr = "0.0.0.0";
port = 8443;
port = 8448;
ssl = true;
}
];