mirror of
https://github.com/dali99/nixos-matrix-modules.git
synced 2026-01-19 22:18:22 +01:00
Compare commits
8 Commits
presence-s
...
time-to-br
| Author | SHA1 | Date | |
|---|---|---|---|
| f5c6d3f72c | |||
| 66ff528912 | |||
| 8199f88a5a | |||
|
|
bf997073d9 | ||
| c158a35ea2 | |||
| 362496f4aa | |||
| cf89fa8eb9 | |||
| 59e39d551d |
21
COPYING
Normal file
21
COPYING
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020, 2022-2023 Daniel Løvbrøtte Olsen and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -9,6 +9,10 @@ With matrix.YOURDOMAIN pointing at the server:
|
||||
|
||||
workers.federationSenders = 1;
|
||||
workers.federationReceivers = 1;
|
||||
workers.initialSyncers = 1;
|
||||
workers.normalSyncers = 1;
|
||||
workers.eventPersisters = 2;
|
||||
workers.useUserDirectoryWorker = true;
|
||||
|
||||
enableNginx = true;
|
||||
|
||||
@@ -31,4 +35,4 @@ With matrix.YOURDOMAIN pointing at the server:
|
||||
}
|
||||
```
|
||||
|
||||
is ~enough to get a functional matrix-server running one federation sender and one federation receiver
|
||||
is ~enough to get a functional matrix-server running with some workers
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
outputs = { self, nixpkgs-lib }: {
|
||||
nixosModules = {
|
||||
synapse = import ./synapse-module { matrix-lib = self.lib; };
|
||||
synapse = import ./synapse-module;
|
||||
};
|
||||
lib = import ./lib.nix { lib = nixpkgs-lib.lib; };
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{ matrix-lib }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
let
|
||||
matrix-lib = (import ../lib.nix { inherit lib; });
|
||||
|
||||
cfg = config.services.matrix-synapse-next;
|
||||
wcfg = cfg.workers;
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ in
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."${cfg.public_baseurl}" = {
|
||||
enableACME = true;
|
||||
enableACME = lib.mkDefault true;
|
||||
forceSSL = true;
|
||||
locations."/_matrix" = {
|
||||
proxyPass = "http://$synapse_backend";
|
||||
|
||||
@@ -69,20 +69,6 @@ in {
|
||||
default = "synapse.app.generic_worker";
|
||||
};
|
||||
|
||||
worker_replication_host = mkOption {
|
||||
type = types.str;
|
||||
default = wcfg.mainReplicationHost;
|
||||
defaultText = literalExpression "${wcfgText}.mainReplicationHost";
|
||||
description = "The replication listeners IP on the main synapse process";
|
||||
};
|
||||
|
||||
worker_replication_http_port = mkOption {
|
||||
type = types.port;
|
||||
default = wcfg.mainReplicationPort;
|
||||
defaultText = literalExpression "${wcfgText}.mainReplicationPort";
|
||||
description = "The replication listeners port on the main synapse process";
|
||||
};
|
||||
|
||||
worker_listeners = mkOption {
|
||||
type = types.listOf (workerListenerType instanceCfg);
|
||||
description = "Listener configuration for the worker, similar to the main synapse listener";
|
||||
@@ -251,11 +237,18 @@ in {
|
||||
federation_sender_instances =
|
||||
lib.genList (i: "auto-fed-sender${toString (i + 1)}") wcfg.federationSenders;
|
||||
|
||||
instance_map = genAttrs' (lib.lists.range 1 wcfg.eventPersisters)
|
||||
instance_map = (lib.mkIf (cfg.workers.instances != { }) ({
|
||||
main = let
|
||||
host = lib.head mainReplicationListener.bind_addresses;
|
||||
in {
|
||||
host = if builtins.elem host [ "0.0.0.0" "::"] then "127.0.0.1" else host;
|
||||
port = mainReplicationListener.port;
|
||||
};
|
||||
} // genAttrs' (lib.lists.range 1 wcfg.eventPersisters)
|
||||
(i: "auto-event-persist${toString i}")
|
||||
(i: let
|
||||
wRL = matrix-lib.firstListenerOfType "replication" wcfg.instances."auto-event-persist${toString i}".settings.worker_listeners;
|
||||
in matrix-lib.connectionInfo wRL);
|
||||
in matrix-lib.connectionInfo wRL)));
|
||||
|
||||
stream_writers.events =
|
||||
mkIf (wcfg.eventPersisters > 0)
|
||||
@@ -340,21 +333,23 @@ in {
|
||||
wantedBy = [ "matrix-synapse.target" ];
|
||||
after = [ "matrix-synapse.service" ];
|
||||
requires = [ "matrix-synapse.service" ];
|
||||
environment.PYTHONPATH = lib.makeSearchPathOutput "lib" cfg.package.python.sitePackages [
|
||||
pluginsEnv
|
||||
];
|
||||
environment = {
|
||||
PYTHONPATH = lib.makeSearchPathOutput "lib" cfg.package.python.sitePackages [
|
||||
pluginsEnv
|
||||
];
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "notify";
|
||||
User = "matrix-synapse";
|
||||
Group = "matrix-synapse";
|
||||
Slice = "system-matrix-synapse.slice";
|
||||
WorkingDirectory = cfg.dataDir;
|
||||
ExecStartPre = pkgs.writers.writeBash "wait-for-synapse" ''
|
||||
# From https://md.darmstadt.ccc.de/synapse-at-work
|
||||
while ! systemctl is-active -q matrix-synapse.service; do
|
||||
sleep 1
|
||||
done
|
||||
'';
|
||||
# ExecStartPre = pkgs.writers.writeBash "wait-for-synapse" ''
|
||||
# # From https://md.darmstadt.ccc.de/synapse-at-work
|
||||
# while ! systemctl is-active -q matrix-synapse.service; do
|
||||
# sleep 1
|
||||
# done
|
||||
# '';
|
||||
ExecStart = let
|
||||
flags = lib.cli.toGNUCommandLineShell {} {
|
||||
config-path = [ matrix-synapse-common-config (workerConfig worker) ] ++ cfg.extraConfigFiles;
|
||||
|
||||
Reference in New Issue
Block a user