synix/tests/run/synapse.nix
sid ecf5132cbb
Some checks failed
Build tests / build-hosts (pull_request) Failing after 3s
Flake check / flake-check (pull_request) Failing after 13s
enforce new flake schema. formatting.
2026-05-31 18:50:41 +02:00

98 lines
2.4 KiB
Nix

{
name = "synapse-test";
nodes.machine =
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.matrix-synapse;
keyFile = pkgs.writeText "livekit.key" "API Secret: secret";
in
{
# fake sops module
options.sops = lib.mkOption {
type = lib.types.attrs;
default = { };
};
imports = [
../../modules/nixos/matrix-synapse
../../modules/nixos/coturn
../../modules/nixos/maubot
];
config = {
services = {
matrix-synapse = {
enable = true;
coturn.enable = true;
settings = {
registration_shared_secret = "secret";
turn_shared_secret = "turn-secret";
};
};
coturn = {
enable = true;
no-tls = true;
static-auth-secret = "turn-secret";
};
maubot = {
enable = true;
extraConfigFile = builtins.toString (
pkgs.writeText "maubot-extra" ''
homeservers:
${cfg.settings.server_name}:
url: http://127.0.0.1:${builtins.toString cfg.port}
secret: ${cfg.settings.registration_shared_secret}
admins:
alice: password
''
);
};
livekit.keyFile = keyFile;
lk-jwt-service.keyFile = keyFile;
nginx.enable = true;
nginx.virtualHosts."example.com" = {
forceSSL = lib.mkForce false;
enableACME = lib.mkForce false;
};
};
networking.domain = "example.com";
networking.firewall.enable = false; # simplify networking for test
};
};
testScript = ''
start_all()
machine.wait_for_unit("default.target")
machine.wait_for_unit("matrix-synapse.service")
machine.wait_for_open_port(8008)
machine.wait_for_unit("livekit.service")
machine.wait_for_open_port(7880)
machine.wait_for_unit("lk-jwt-service.service")
machine.wait_for_open_port(8080)
machine.wait_for_unit("coturn.service")
machine.wait_for_open_port(3478)
machine.wait_for_unit("maubot.service")
machine.wait_for_open_port(29316)
machine.succeed("curl -f http://localhost:8008/_matrix/client/versions")
# machine.succeed("curl -f http://localhost:29316/_matrix/maubot/v1/logs") # TODO: add auth
'';
}