From 3d89098bfe2f397d831861af9ebed43d6efebd00 Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Fri, 2 Sep 2022 17:19:59 +0300 Subject: [PATCH] stuff --- hosts/wolumonde/modules/conduit.nix | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 hosts/wolumonde/modules/conduit.nix diff --git a/hosts/wolumonde/modules/conduit.nix b/hosts/wolumonde/modules/conduit.nix new file mode 100644 index 0000000..a6a97e4 --- /dev/null +++ b/hosts/wolumonde/modules/conduit.nix @@ -0,0 +1,40 @@ +{config, pkgs, ...}: +let + wellKnownFileClient = + pkgs.writeText "client" ( + builtins.toJSON + { "m.homeserver"."base_url" = "https://matrix.gaze.systems"; } + ); + wellKnownFileServer = + pkgs.writeText "server" + (builtins.toJSON { "m.server" = "matrix.gaze.systems:443"; }); +in +{ + services.matrix-conduit = { + enable = true; + settings.global = { + server_name = "gaze.systems"; + max_request_size = 1000 * 1000 * 20; + allow_registration = true; + allow_federation = true; + trusted_servers = ["matrix.org" "nixos.dev" "conduit.rs"]; + address = "::1"; + port = 6167; + }; + }; + + services.nginx.virtualHosts."matrix.gaze.systems" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = + "http://localhost:${toString config.services.matrix-conduit.settings.global.port}"; + }; + services.nginx.virtualHosts."gaze.systems" = { + locations."/.well-known/matrix/client".extraConfig = '' + alias ${wellKnownFileClient} + ''; + locations."/.well-known/matrix/server".extraConfig = '' + alias ${wellKnownFileServer} + ''; + }; +}