tsuki: use matrix-synapse-next module with workers

This commit is contained in:
Oystein Kristoffer Tveit 2023-01-20 19:52:04 +01:00
parent 47d8aa7899
commit e840a95ebe
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
2 changed files with 38 additions and 35 deletions

View File

@ -48,6 +48,10 @@
url = "github:infinidoge/nix-minecraft"; url = "github:infinidoge/nix-minecraft";
}; };
matrix-synapse-next = {
url = "github:dali99/nixos-matrix-modules";
};
vscode-server = { vscode-server = {
url = "github:msteen/nixos-vscode-server"; url = "github:msteen/nixos-vscode-server";
flake = false; flake = false;
@ -70,14 +74,16 @@
nixpkgs-unstable, nixpkgs-unstable,
home-manager, home-manager,
home-manager-local, home-manager-local,
nix-attr-search,
vscode-server, dotfiles,
secrets,
fonts, fonts,
osuchan, matrix-synapse-next,
maunium-stickerpicker, maunium-stickerpicker,
minecraft, minecraft,
dotfiles, nix-attr-search,
osuchan,
secrets,
vscode-server,
website website
}: let }: let
system = "x86_64-linux"; system = "x86_64-linux";
@ -139,6 +145,7 @@
secrets.outputs.nixos-config secrets.outputs.nixos-config
osuchan.outputs.nixosModules.default osuchan.outputs.nixosModules.default
minecraft.outputs.nixosModules.minecraft-servers minecraft.outputs.nixosModules.minecraft-servers
matrix-synapse-next.nixosModules.synapse
{ {
config._module.args = { config._module.args = {

View File

@ -10,8 +10,20 @@
./coturn.nix ./coturn.nix
]; ];
services.matrix-synapse = { services.matrix-synapse-next = {
enable = true; enable = true;
enableNginx = true;
dataDir = "${config.machineVars.dataDrives.default}/var/matrix";
workers = {
federationSenders = 3;
federationReceivers = 3;
initialSyncers = 1;
normalSyncers = 1;
eventPersisters = 1;
useUserDirectoryWorker = true;
};
settings = { settings = {
turn_uris = let turn_uris = let
inherit (config.services.coturn) realm; inherit (config.services.coturn) realm;
@ -28,9 +40,7 @@
in [ in [
{ {
server_name = "matrix.org"; server_name = "matrix.org";
verify_keys = { verify_keys."ed25519:auto" = "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw";
"ed25519:auto" = "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw";
};
} }
(emptykey "pvv.ntnu.no") (emptykey "pvv.ntnu.no")
(emptykey "feal.no") (emptykey "feal.no")
@ -42,25 +52,6 @@
enable_metrics = true; enable_metrics = true;
listeners = [
{
port = secrets.ports.matrix.listener;
bind_addresses = [
"0.0.0.0"
"::1"
];
type = "http";
tls = false;
x_forwarded = true;
resources = [
{
names = [ "client" "federation" "metrics" ];
compress = false;
}
];
}
];
# NOTE: To register a new admin user, use a nix-shell with # NOTE: To register a new admin user, use a nix-shell with
# package 'matrix-synapse', and use the register_new_matrix_user command # package 'matrix-synapse', and use the register_new_matrix_user command
# with the registration shared secret # with the registration shared secret
@ -70,12 +61,17 @@
# password_config.enabled = lib.mkForce false; # password_config.enabled = lib.mkForce false;
dataDir = "${config.machineVars.dataDrives.default}/var/matrix"; database = {
name = "psycopg2";
database_type = "postgres"; args = {
# database_args = { user = "matrix-synapse";
# password = "synapse"; # TODO: Generate proper password
# }; password = "";
database = "matrix-synapse";
host = "localhost";
port = secrets.ports.postgres;
};
};
# TODO: Figure out a way to do this declaratively. # TODO: Figure out a way to do this declaratively.
# The files need to be owned by matrix-synapse # The files need to be owned by matrix-synapse
@ -90,7 +86,7 @@
}; };
}; };
# services.redis.enable = true; services.redis.servers."".enable = true;
networking.firewall = { networking.firewall = {
interfaces.enp2s0 = let interfaces.enp2s0 = let