diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2022-02-08 22:46:00 +0100 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2022-03-04 23:57:34 +0100 |
commit | a483264931826f410638c9af4d58b620715d1ae3 (patch) | |
tree | 230e3216afd062f6a74ec3067f5d4fd1b4eadf3a | |
parent | 625ba6b0faad37d321eee6c3f11fd89298553deb (diff) | |
download | nixpkgs-a483264931826f410638c9af4d58b620715d1ae3.tar nixpkgs-a483264931826f410638c9af4d58b620715d1ae3.tar.gz nixpkgs-a483264931826f410638c9af4d58b620715d1ae3.tar.bz2 nixpkgs-a483264931826f410638c9af4d58b620715d1ae3.tar.lz nixpkgs-a483264931826f410638c9af4d58b620715d1ae3.tar.xz nixpkgs-a483264931826f410638c9af4d58b620715d1ae3.tar.zst nixpkgs-a483264931826f410638c9af4d58b620715d1ae3.zip |
nixos/matrix-synapse: fix registerNewMatrixUser script
-rw-r--r-- | nixos/modules/services/misc/matrix-synapse.nix | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/nixos/modules/services/misc/matrix-synapse.nix b/nixos/modules/services/misc/matrix-synapse.nix index 40ffbff7215..c4d14dbd547 100644 --- a/nixos/modules/services/misc/matrix-synapse.nix +++ b/nixos/modules/services/misc/matrix-synapse.nix @@ -32,16 +32,22 @@ let ) (lib.last cfg.settings.listeners) cfg.settings.listeners; # FIXME: Handle cases with missing client listener properly, # don't rely on lib.last, this will not work. + + # add a tail, so that without any bind_addresses we still have a useable address + bindAddress = head (listener.bind_addresses ++ [ "127.0.0.1" ]); + listenerProtocol = if listener.tls + then "https" + else "http"; 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 (head listener.bind_addresses)) then - "[${head listener.bind_addresses}]" + "${listenerProtocol}://${ + if (isIpv6 bindAddress) then + "[${bindAddress}]" else - "${head listener.bind_addresses}" + "${bindAddress}" }:${builtins.toString listener.port}/" ''; in { |