1
2
mirror of https://github.com/dali99/nixos-matrix-modules.git synced 2026-01-19 22:18:22 +01:00

8 Commits

Author SHA1 Message Date
f5c6d3f72c disable the wait-for-script temporarily
https://github.com/NixOS/nixpkgs/pull/241973/files#diff-ad0db3f4b3d5cdddf08d7a7d16c7fc1502c54b9ce56b09077879a4c157cd6374R1065
2023-09-12 21:38:35 +02:00
66ff528912 Update README.MD 2023-09-11 00:04:19 +02:00
8199f88a5a Update README.MD 2023-09-11 00:03:44 +02:00
lon
bf997073d9 fix: don't force enableACME to allow useACMEHost 2023-07-27 22:10:46 +02:00
c158a35ea2 emergency handling of deprecations 2023-07-13 04:16:00 +02:00
362496f4aa move matrix-lib to let block
Else it has to be called with { } which modules cant do
2023-02-17 23:59:59 +01:00
cf89fa8eb9 load matrix-lib directly inside module
To enable use with non-flakes
2023-02-17 23:44:47 +01:00
59e39d551d Add a license
Co-authored-by: h7x4 <h7x4@nani.wtf>
2023-02-17 01:16:02 +01:00
6 changed files with 51 additions and 30 deletions

21
COPYING Normal file
View 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.

View File

@@ -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

View File

@@ -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; };
};

View File

@@ -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;

View File

@@ -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";

View File

@@ -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;