summary refs log tree commit diff
path: root/host/Spacebar-synapse/configuration.nix
blob: a06a83db0865480f6c1d2d6b576beb09fb8c8ab4 (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{ config, pkgs, lib, ... }:

{
  imports =
    [
      ../../modules/base-server.nix
    ];

  networking = {
    hostName = "Spacebar-synapse";
    interfaces.ens18.ipv4.addresses = [ { 
      address = "192.168.1.5";
      prefixLength = 24;
    } ];
    interfaces.ens19.ipv4.addresses = [ {
      address = "10.10.11.5";
      prefixLength = 16;
    } ];
  };

  # Discord bridge
  services.matrix-appservice-discord = {
    enable = false; # Alicia - figure out secret first...
    environmentFile = /etc/keyring/matrix-appservice-discord/tokens.env;
    settings = {
      bridge = {
        domain = "spacebar.chat";
        homeserverUrl = "https://matrix.spacebar.chat";
      };
      database = {
        connString = "postgres://postgres@192.168.1.3/matrix-appservice-discord";
      };
    };
  };

  services.matrix-synapse = {
    enable = true;
    settings = {
      server_name = "spacebar.chat";
      enable_registration = false;
      registration_shared_secret_path = "/var/lib/matrix-synapse/registration_shared_secret.txt";
      # Alicia - types: https://github.com/NixOS/nixpkgs/blob/release-22.11/nixos/modules/services/matrix/synapse.nix#L410
      listeners = [
        { 
          port = 8008;
          bind_addresses = [ "192.168.1.5" "127.0.0.1" ];
          type = "http";
          tls = false;
          x_forwarded = true;
          resources = [ {
            names = [ "client" "federation" ];
            compress = true;
          } ];
        }
      ];
      dynamic_thumbnails = true;
      presence = {
        enable = true;
        update_interval = 60;
      };
      url_preview_enabled = true;
      
      database = {
        name = "psycopg2";
        args = {
          user = "matrix-synapse-spacebar-chat";
          password = "somepassword";
          database = "matrix-synapse-spacebar-chat";
          host = "192.168.1.3";
        };
      };
      app_service_config_files = [ ];
    };

    plugins = with pkgs.matrix-synapse-plugins; [ ];
  };

  # Alicia - doesnt work yet... until in nixpkgs...
  services.draupnir = {
    enable = true;
    
    pantalaimon = {
      enable = true;
      username = "draupnir";
      passwordFile = "/etc/draupnir-password";
      options = {
        homeserver = "http://localhost:8008";
        ssl = false;
      };
    };
    managementRoom = "#draupnir-mgmt:spacebar.chat";
    homeserverUrl = "http://localhost:8008";
    verboseLogging = false;
    settings = {
      recordIgnoredInvites = false;
      automaticallyRedactForReasons = [ "*" ];
      fasterMembershipChecks = true;
      backgroundDelayMS = 100;
      pollReports = true;
      admin.enableMakeRoomAdminCommand = true;
      commands.ban.defaultReasons = [
        "spam"
        "harassment"
        "transphobia"
        "scam"
      ];
      protections = {
        wordlist = {
          words = [
            "tranny"
            "faggot"
          ];
          minutesBeforeTrusting = 0;
        };
      };
    };
  };

  system.stateVersion = "22.11"; # DO NOT EDIT!
}