diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2022-05-12 01:40:28 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2022-05-12 01:40:28 +0900 |
commit | 6753ad7cad7ea720fea73c91bff9df6f27d80368 (patch) | |
tree | 27902d376906d9f3c68b801a086a06b15d62cc66 /matrix.nix | |
parent | 9d80f26bcbf2150e31a3b626d28cf7fc6a878c82 (diff) | |
download | nixos-conf-6753ad7cad7ea720fea73c91bff9df6f27d80368.tar.gz |
Draft Dendrite set up
Diffstat (limited to 'matrix.nix')
-rw-r--r-- | matrix.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/matrix.nix b/matrix.nix new file mode 100644 index 0000000..6fb9d35 --- /dev/null +++ b/matrix.nix @@ -0,0 +1,44 @@ +{ config, pkgs, ... }: +let domain = config.networking.domain; +in { + services = { + dendrite = { + enable = true; + settings = let + dburl = "postgres:///dendrite?host=/run/postgresql"; + workingDir = "/var/lib/dendrite"; # hardcoded in service + in { + app_service_api.database.connection_string = dburl; + federation_api.database.connection_string = dburl; + global = { + server_name = domain; + private_key = "${workingDir}/matrix_key.pem"; + trusted_third_party_id_servers = [ ]; + }; + key_server.database.connection_string = dburl; + media_api.database.connection_string = dburl; + mscs.database.connection_string = dburl; + room_server.database.connection_string = dburl; + sync_api.database.connection_string = dburl; + user_api.account_database.connection_string = dburl; + user_api.device_database.connection_string = dburl; + }; + }; + + nginx.virtualHosts.${domain}.locations."/_matrix".proxyPass = let + port = toString config.services.dendrite.httpPort; + in "http://localhost:${port}"; + + postgresql = { + enable = true; + ensureDatabases = [ "dendrite" ]; + ensureUsers = [ + { + name = "dendrite"; + ensurePermissions."DATABASE dendrite" = "ALL PRIVILEGES"; + } + ]; + package = pkgs.postgresql; + }; + }; +} |