summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-01-02 06:49:28 +0530
committersinanmohd <sinan@sinanmohd.com>2024-01-02 06:49:28 +0530
commitc8a3e45ae7c99cf20168df4d1cf5ff45e3eedaa3 (patch)
tree25d8a8b22e528f1a55448eb786c65758406cd0bd /modules
parent317a0d1d6eaa48ffef7a9e4969e7c67e68cdeb15 (diff)
modules/matrix_sliding_sync: drop upstreamed changes
Diffstat (limited to 'modules')
-rw-r--r--modules/matrix-sliding-sync.nix109
1 files changed, 0 insertions, 109 deletions
diff --git a/modules/matrix-sliding-sync.nix b/modules/matrix-sliding-sync.nix
deleted file mode 100644
index 3785515..0000000
--- a/modules/matrix-sliding-sync.nix
+++ /dev/null
@@ -1,109 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-let
- cfg = config.services.matrix-sliding-sync;
-in
-{
- imports = [
- (lib.mkRenamedOptionModule
- [ "services" "matrix-synapse" "sliding-sync" ]
- [ "services" "matrix-sliding-sync" ]
- )
- ];
-
- options.services.matrix-sliding-sync = {
- enable = lib.mkEnableOption (lib.mdDoc "sliding sync");
-
- package = lib.mkPackageOption pkgs "matrix-sliding-sync" { };
-
- settings = lib.mkOption {
- type = lib.types.submodule {
- freeformType = with lib.types; attrsOf str;
- options = {
- SYNCV3_SERVER = lib.mkOption {
- type = lib.types.str;
- description = lib.mdDoc ''
- The destination homeserver to talk to not including `/_matrix/` e.g `https://matrix.example.org`.
- '';
- };
-
- SYNCV3_DB = lib.mkOption {
- type = lib.types.str;
- default = "postgresql:///matrix-sliding-sync?host=/run/postgresql";
- description = lib.mdDoc ''
- The postgres connection string.
- Refer to <https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING>.
- '';
- };
-
- SYNCV3_BINDADDR = lib.mkOption {
- type = lib.types.str;
- default = "127.0.0.1:8009";
- example = "[::]:8008";
- description = lib.mdDoc "The interface and port to listen on.";
- };
-
- SYNCV3_LOG_LEVEL = lib.mkOption {
- type = lib.types.enum [ "trace" "debug" "info" "warn" "error" "fatal" ];
- default = "info";
- description = lib.mdDoc "The level of verbosity for messages logged.";
- };
- };
- };
- default = { };
- description = lib.mdDoc ''
- Freeform environment variables passed to the sliding sync proxy.
- Refer to <https://github.com/matrix-org/sliding-sync#setup> for all supported values.
- '';
- };
-
- createDatabase = lib.mkOption {
- type = lib.types.bool;
- default = true;
- description = lib.mdDoc ''
- Whether to enable and configure `services.postgres` to ensure that the database user `matrix-sliding-sync`
- and the database `matrix-sliding-sync` exist.
- '';
- };
-
- environmentFile = lib.mkOption {
- type = lib.types.str;
- description = lib.mdDoc ''
- Environment file as defined in {manpage}`systemd.exec(5)`.
-
- This must contain the {env}`SYNCV3_SECRET` variable which should
- be generated with {command}`openssl rand -hex 32`.
- '';
- };
- };
-
- config = lib.mkIf cfg.enable {
- services.postgresql = lib.optionalAttrs cfg.createDatabase {
- enable = true;
- ensureDatabases = [ "matrix-sliding-sync" ];
- ensureUsers = [ {
- name = "matrix-sliding-sync";
- ensureDBOwnership = true;
- } ];
- };
-
- systemd.services.matrix-sliding-sync = rec {
- after =
- lib.optional cfg.createDatabase "postgresql.service"
- ++ lib.optional config.services.dendrite.enable "dendrite.service"
- ++ lib.optional config.services.matrix-synapse.enable config.services.matrix-synapse.serviceUnit;
- wants = after;
- wantedBy = [ "multi-user.target" ];
- environment = cfg.settings;
- serviceConfig = {
- DynamicUser = true;
- EnvironmentFile = cfg.environmentFile;
- ExecStart = lib.getExe cfg.package;
- StateDirectory = "matrix-sliding-sync";
- WorkingDirectory = "%S/matrix-sliding-sync";
- Restart = "on-failure";
- RestartSec = "1s";
- };
- };
- };
-}