diff options
Diffstat (limited to 'nixos/modules/services/misc/matrix-synapse.nix')
-rw-r--r-- | nixos/modules/services/misc/matrix-synapse.nix | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/matrix-synapse.nix b/nixos/modules/services/misc/matrix-synapse.nix index 404163d2de6c5..feca4c5465ff5 100644 --- a/nixos/modules/services/misc/matrix-synapse.nix +++ b/nixos/modules/services/misc/matrix-synapse.nix @@ -119,6 +119,30 @@ ${cfg.extraConfig} hasLocalPostgresDB = let args = cfg.database_args; in usePostgresql && (!(args ? host) || (elem args.host [ "localhost" "127.0.0.1" "::1" ])); + + registerNewMatrixUser = + let + isIpv6 = x: lib.length (lib.splitString ":" x) > 1; + listener = + lib.findFirst ( + listener: lib.any ( + resource: lib.any ( + name: name == "client" + ) resource.names + ) listener.resources + ) (lib.last cfg.listeners) cfg.listeners; + in + pkgs.writeShellScriptBin "matrix-synapse-register_new_matrix_user" '' + exec ${cfg.package}/bin/register_new_matrix_user \ + $@ \ + ${lib.concatMapStringsSep " " (x: "-c ${x}") ([ configFile ] ++ cfg.extraConfigFiles)} \ + "${listener.type}://${ + if (isIpv6 listener.bind_address) then + "[${listener.bind_address}]" + else + "${listener.bind_address}" + }:${builtins.toString listener.port}/" + ''; in { options = { services.matrix-synapse = { @@ -294,7 +318,7 @@ in { description = '' List of resources to host on this listener. ''; - example = ["client" "webclient" "federation"]; + example = ["client" "federation"]; }; compress = mkOption { type = types.bool; @@ -319,7 +343,7 @@ in { tls = true; x_forwarded = false; resources = [ - { names = ["client" "webclient"]; compress = true; } + { names = ["client"]; compress = true; } { names = ["federation"]; compress = false; } ]; }]; @@ -792,6 +816,8 @@ in { UMask = "0077"; }; }; + + environment.systemPackages = [ registerNewMatrixUser ]; }; imports = [ |