summaryrefslogtreecommitdiff
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
parent317a0d1d6eaa48ffef7a9e4969e7c67e68cdeb15 (diff)
modules/matrix_sliding_sync: drop upstreamed changes
-rw-r--r--common.nix2
-rw-r--r--flake.lock18
-rw-r--r--modules/matrix-sliding-sync.nix109
3 files changed, 9 insertions, 120 deletions
diff --git a/common.nix b/common.nix
index 2f3f04f..dac1a0f 100644
--- a/common.nix
+++ b/common.nix
@@ -10,14 +10,12 @@ in
{
disabledModules = [
"services/networking/pppd.nix"
- "services/matrix/matrix-sliding-sync.nix"
"tasks/network-interfaces-scripted.nix"
];
imports = [
./modules/userdata.nix
./modules/dev.nix
./modules/pppd.nix
- ./modules/matrix-sliding-sync.nix
./modules/network-interfaces-scripted.nix
];
diff --git a/flake.lock b/flake.lock
index 88d1f50..7e130b9 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
- "lastModified": 1703013332,
- "narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=",
+ "lastModified": 1703961334,
+ "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=",
"owner": "NixOs",
"repo": "nixpkgs",
- "rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6",
+ "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9",
"type": "github"
},
"original": {
@@ -18,11 +18,11 @@
},
"nixpkgs-stable": {
"locked": {
- "lastModified": 1702777222,
- "narHash": "sha256-/SYmqgxTYzqZnQEfbOCHCN4GzqB9uAIsR9IWLzo0/8I=",
+ "lastModified": 1703950681,
+ "narHash": "sha256-veU5bE4eLOmi7aOzhE7LfZXcSOONRMay0BKv01WHojo=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "a19a71d1ee93226fd71984359552affbc1cd3dc3",
+ "rev": "0aad9113182747452dbfc68b93c86e168811fa6c",
"type": "github"
},
"original": {
@@ -46,11 +46,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
- "lastModified": 1702937567,
- "narHash": "sha256-bUNl3GPqRgTGp13+oV1DrYa1/NHuGHo5SKmr+RqC/2g=",
+ "lastModified": 1703991717,
+ "narHash": "sha256-XfBg2dmDJXPQEB8EdNBnzybvnhswaiAkUeeDj7fa/hQ=",
"owner": "Mic92",
"repo": "sops-nix",
- "rev": "f7db64b88dabc95e4f7bee20455f418e7ab805d4",
+ "rev": "cfdbaf68d00bc2f9e071f17ae77be4b27ff72fa6",
"type": "github"
},
"original": {
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";
- };
- };
- };
-}