Skip to content

matrix-synapse

A federated messaging server with end-to-end encryption.

Social

This NixOS module installs and configures Synapse — a federated Matrix homeserver with end-to-end encryption — and optionally provides the Element web client.

The example below demonstrates a minimal setup that includes:

  • Element web client.
  • Synapse backed by PostgreSQL and nginx.
  • An admin user and an additional regular user.

Example configuration:

instances = {
    matrix-synapse = {
        roles.default.machines."jon".settings = {
            acmeEmail = "admins@clan.lol";
            server_tld = "clan.test";
            app_domain = "matrix.clan.test";
            users.admin.admin = true;
            users.someuser = { };
        };
    };
};

Roles

The matrix-synapse service has the following roles:

  • default

Options for the default role

acmeEmail

Email address for account creation and correspondence from the CA. It is recommended to use the same email for all certs to avoid account creation limits.

Type: string

Declared in: clanServices/matrix-synapse/default.nix

app_domain

The matrix server hostname also serves the element client

Type: string

Example
"matrix.example.com"

Declared in: clanServices/matrix-synapse/default.nix

server_tld

The address that is suffixed after your username i.e @alice:example.com

Type: string

Example
"example.com"

Declared in: clanServices/matrix-synapse/default.nix

services.matrix-synapse.package

Package to use for matrix-synapse

Type: unspecified value

Declared in: clanServices/matrix-synapse/default.nix

users

A list of users. Not that only new users will be created and existing ones are not modified.

Type: attribute set of (submodule)

Default:

{ }
Example
{
  alice = {
    admin = true;
  };
}

Declared in: clanServices/matrix-synapse/default.nix

users.<name>.admin

Whether the user should be an admin

Type: boolean

Default:

false

Declared in: clanServices/matrix-synapse/default.nix

users.<name>.name

The name of the user

Type: string

Default:

"‹name›"

Declared in: clanServices/matrix-synapse/default.nix