feat(matrix): add conduit as default matrix server
This commit is contained in:
parent
c73c212cd6
commit
1b7b6596a8
6 changed files with 202 additions and 9 deletions
services/matrix
52
services/matrix/conduit.nix
Normal file
52
services/matrix/conduit.nix
Normal 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}';
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./dendrite.nix ./element.nix ];
|
||||
imports = [ ./conduit.nix ./element.nix ];
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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" = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue