feat(matrix): add conduit as default matrix server

This commit is contained in:
Felix Schröter 2023-07-29 18:00:49 +02:00
parent c73c212cd6
commit 1b7b6596a8
Signed by: felschr
GPG key ID: 671E39E6744C807D
6 changed files with 202 additions and 9 deletions

View file

@ -0,0 +1,52 @@
{ inputs, config, pkgs, ... }:
let
server_name = "felschr.com";
domain = "matrix.${server_name}";
in {
services.matrix-conduit = {
enable = true;
package = inputs.conduit.packages.${pkgs.system}.default;
settings.global = {
inherit server_name;
database_backend = "rocksdb";
trusted_servers = [ "matrix.org" "libera.chat" "nixos.org" ];
};
};
services.nginx.virtualHosts.${domain} = {
enableACME = true;
forceSSL = true;
locations."/_matrix/" = {
proxyPass = "http://[::1]:${
toString config.services.matrix-conduit.settings.global.port
}";
proxyWebsockets = true;
extraConfig = ''
proxy_buffering off;
'';
};
};
services.nginx.virtualHosts.${server_name} = {
enableACME = true;
forceSSL = true;
locations = let
server = { "m.server" = "${domain}:443"; };
client = {
"m.homeserver"."base_url" = "https://${domain}";
"m.identity_server"."base_url" = "https://vector.im";
};
in {
"= /.well-known/matrix/server".extraConfig = ''
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
"= /.well-known/matrix/client".extraConfig = ''
add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}';
'';
};
};
}

View file

@ -1,5 +1,5 @@
{ ... }:
{
imports = [ ./dendrite.nix ./element.nix ];
imports = [ ./conduit.nix ./element.nix ];
}

View file

@ -1,7 +1,6 @@
{ config, pkgs, ... }:
let
inherit (config.services) dendrite;
server_name = "felschr.com";
domain = "matrix.${server_name}";
database = {
@ -87,6 +86,7 @@ in {
server = { "m.server" = "${domain}:443"; };
client = {
"m.homeserver"."base_url" = "https://${domain}";
"org.matrix.msc3575.proxy"."url" = "https://${domain}";
"m.identity_server"."base_url" = "https://vector.im";
};
in {

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }:
let
inherit (config.services.dendrite.settings.global) server_name;
inherit (config.services.matrix-conduit.settings.global) server_name;
matrix_host = "matrix.${server_name}";
in {
services.nginx.virtualHosts."element.felschr.com" = {