From 28424ccb86f9fe02c9e9f95958cf10d3a9fe3777 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 27 Dec 2024 13:16:07 +0100 Subject: refactor: split up tente/default.nix --- nixos/hosts/tente/matrix.nix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 nixos/hosts/tente/matrix.nix (limited to 'nixos/hosts/tente/matrix.nix') diff --git a/nixos/hosts/tente/matrix.nix b/nixos/hosts/tente/matrix.nix new file mode 100644 index 0000000..b60f3cd --- /dev/null +++ b/nixos/hosts/tente/matrix.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.matrix; +in +{ + options.matrix = { + serverName = lib.mkOption { + type = lib.types.str; + }; + apiDomain = lib.mkOption { + type = lib.types.str; + }; + }; + + config = { + services = { + matrix-synapse = { + enable = true; + settings = { + server_name = cfg.serverName; + }; + }; + + nginx.virtualHosts.${cfg.apiDomain} = { + enableACME = true; + forceSSL = true; + + # TODO: add locations."/" with some message + + # Forward all Matrix API calls to the synapse Matrix homeserver. A trailing slash + # *must not* be used here. + locations."/_matrix".proxyPass = "http://127.0.0.1:8008"; + # Forward requests for e.g. SSO and password-resets. + locations."/_synapse/client".proxyPass = "http://127.0.0.1:8008"; + }; + }; + }; +} -- cgit v1.2.3