summaryrefslogtreecommitdiff
path: root/sys/conduit/default.nix
blob: 597960b69032883f2365bc74c59e270cbe436dac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ config, flakes, lib, pkgs, ... }:
with lib; let
  cfg = config.local.conduit;

  fqdn = config.local.domains.matrix.main;
  inherit (config.local.domains.matrix.passthru) serverName;
in
{
  options.local.conduit = {
    enable = mkEnableOption "conduit Matrix homeserver";

    listenAddress = mkOption {
      type = types.str;
      default = "127.0.0.1";
    };

    listenPort = mkOption {
      type = types.port;
      default = 6167;
    };
  };

  config = mkIf cfg.enable {
    services.matrix-conduit = {
      enable = true;

      package = flakes.conduwuit.packages.${pkgs.system}.default;

      settings.global = {
        port = cfg.listenPort;
        address = cfg.listenAddress;
        server_name = serverName;

        database_backend = "sqlite";

        allow_encryption = true;
        allow_federation = true;
        allow_registration = false;
        enable_lightning_bolt = false;
        allow_check_for_updates = true;
        new_user_displayname_suffix = "";

        well_known = {
          client = "https://${fqdn}";
          server = "${fqdn}:443";
        };
      };
    };
  };
}