ark/hosts/wolumonde/modules/conduit.nix

55 lines
1.6 KiB
Nix
Raw Normal View History

2022-09-02 17:19:59 +03:00
{
2022-09-02 18:02:46 +03:00
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";});
wellKnownFiles = pkgs.runCommand "well-known" {} ''
mkdir -p $out
cp ${_wellKnownFileServer} $out/server
cp ${_wellKnownFileClient} $out/client
'';
in {
2022-09-02 17:19:59 +03:00
services.matrix-conduit = {
enable = true;
2022-09-02 18:02:46 +03:00
package = pkgs.matrix-conduit.overrideAttrs (old: rec {
name = "${old.pname}-${version}";
version = "147f2752";
src = pkgs.fetchFromGitLab {
owner = "famedly";
repo = "conduit";
rev = "147f27521c0d7dbc32d39ec1d8da6cd00008f23c";
sha256 = "sha256-j469Zh8zyqJNWz7q6gjRu1Khk9y6Xbb52SpxzNjADW8=";
};
});
2022-09-02 17:19:59 +03:00
settings.global = {
server_name = "gaze.systems";
max_request_size = 1000 * 1000 * 20;
2022-09-02 18:02:46 +03:00
allow_registration = false;
2022-09-02 17:19:59 +03:00
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;
2022-09-02 18:02:46 +03:00
locations."/".proxyPass = "http://localhost:${toString config.services.matrix-conduit.settings.global.port}";
2022-09-02 17:19:59 +03:00
};
services.nginx.virtualHosts."gaze.systems" = {
2022-09-02 18:02:46 +03:00
locations."/.well-known/matrix/".extraConfig = ''
add_header content-type application/json;
2022-09-02 18:57:30 +03:00
add_header access-control-allow-origin *;
2022-09-02 18:02:46 +03:00
alias ${wellKnownFiles}/;
2022-09-02 17:19:59 +03:00
'';
};
}