Compare commits
3 commits
2ace0c0d7a
...
f03cb23109
| Author | SHA1 | Date | |
|---|---|---|---|
| f03cb23109 | |||
| ec6fb2efa7 | |||
| 57cf518ca2 |
4 changed files with 56 additions and 7 deletions
|
|
@ -0,0 +1,9 @@
|
|||
age-encryption.org/v1
|
||||
-> ssh-ed25519 cKojmg N182xey8TWRVUWTRP16rT0zlhYZNr/pOZVR7YRnlIkk
|
||||
HVqAag55z1cKLgjR3WsUj2wvaVjxm169JcDRJGRvCVU
|
||||
-> ssh-ed25519 jPowng Dc+aaUTxDsMTY+oOst0SC3ldq1e6zX8F5A5uBL5RHhc
|
||||
JWZou6+VaFc5f2OLRIrmFFWg3Er6WSY+TloXU0mP1K8
|
||||
-> |9_9Aqh%-grease $ X8Mn|5 aKnl' fl<D{T-
|
||||
+fAc0cajqxhYWu55HCY
|
||||
--- SrmtWXQXGYxNTabSrb5tBRXHnK1F22Qoiy7hKYrrF+0
|
||||
ñD·û²:,õn0i<>½Àß^ÆŠ`üÔ2Æ#y'ý9ÖñÓÒŽéÿæ<C3BF>r]ÀØ›¹x“³S=ú°ˆôuJéEÛóc€lH Ê~eÅ‚›ŸKtévo'êv+
|
||||
|
|
@ -35,6 +35,9 @@ in
|
|||
owner = "matrix-synapse";
|
||||
publicKeys = all;
|
||||
};
|
||||
"matrix/sliding-sync-secret.age" = {
|
||||
publicKeys = all;
|
||||
};
|
||||
|
||||
"miniflux/credentials.age".publicKeys = all;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ in
|
|||
mailConfigFile = secrets."matrix/mail".path;
|
||||
# Only necessary when doing the initial registration
|
||||
secretFile = secrets."matrix/secret".path;
|
||||
slidingSync = {
|
||||
secretFile = secrets."matrix/sliding-sync-secret".path;
|
||||
};
|
||||
};
|
||||
miniflux = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ let
|
|||
federationPort = { public = 8448; private = 11338; };
|
||||
clientPort = { public = 443; private = 11339; };
|
||||
domain = config.networking.domain;
|
||||
matrixDomain = "matrix.${domain}";
|
||||
in
|
||||
{
|
||||
options.my.services.matrix = with lib; {
|
||||
|
|
@ -25,6 +26,23 @@ in
|
|||
description = "Shared secret to register users";
|
||||
};
|
||||
|
||||
slidingSync = {
|
||||
enable = my.mkDisableOption "sliding sync";
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8009;
|
||||
example = 8084;
|
||||
description = "Port used by sliding sync server";
|
||||
};
|
||||
|
||||
secretFile = mkOption {
|
||||
type = types.str;
|
||||
example = "/var/lib/matrix/sliding-sync-secret-file.env";
|
||||
description = "Secret file which contains SYNCV3_SECRET definition";
|
||||
};
|
||||
};
|
||||
|
||||
mailConfigFile = mkOption {
|
||||
type = types.str;
|
||||
example = "/var/lib/matrix/email-config.yaml";
|
||||
|
|
@ -52,7 +70,7 @@ in
|
|||
|
||||
settings = {
|
||||
server_name = domain;
|
||||
public_baseurl = "https://matrix.${domain}";
|
||||
public_baseurl = "https://${matrixDomain}";
|
||||
|
||||
enable_registration = false;
|
||||
|
||||
|
|
@ -88,6 +106,17 @@ in
|
|||
extraConfigFiles = [
|
||||
cfg.mailConfigFile
|
||||
] ++ lib.optional (cfg.secretFile != null) cfg.secretFile;
|
||||
|
||||
sliding-sync = lib.mkIf cfg.slidingSync.enable {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
SYNCV3_SERVER = "https://${matrixDomain}";
|
||||
SYNCV3_BINDADDR = "127.0.0.1:${cfg.slidingSync.port}";
|
||||
};
|
||||
|
||||
environmentFile = cfg.slidingSync.secretFile;
|
||||
};
|
||||
};
|
||||
|
||||
my.services.nginx.virtualHosts = [
|
||||
|
|
@ -98,7 +127,7 @@ in
|
|||
conf = {
|
||||
default_server_config = {
|
||||
"m.homeserver" = {
|
||||
"base_url" = "https://matrix.${domain}";
|
||||
"base_url" = "https://${matrixDomain}";
|
||||
"server_name" = domain;
|
||||
};
|
||||
"m.identity_server" = {
|
||||
|
|
@ -120,7 +149,7 @@ in
|
|||
|
||||
# Those are too complicated to use my wrapper...
|
||||
services.nginx.virtualHosts = {
|
||||
"matrix.${domain}" = {
|
||||
${matrixDomain} = {
|
||||
onlySSL = true;
|
||||
useACMEHost = domain;
|
||||
|
||||
|
|
@ -138,6 +167,11 @@ in
|
|||
|
||||
"/_matrix" = proxyToClientPort;
|
||||
"/_synapse/client" = proxyToClientPort;
|
||||
|
||||
# Sliding sync
|
||||
"~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync)" = {
|
||||
proxyPass = "http://${config.services.matrix-synapse.sliding-sync.settings.SYNCV3_BINDADDR}";
|
||||
};
|
||||
};
|
||||
|
||||
listen = [
|
||||
|
|
@ -148,9 +182,9 @@ in
|
|||
};
|
||||
|
||||
# same as above, but listening on the federation port
|
||||
"matrix.${domain}_federation" = {
|
||||
"${matrixDomain}_federation" = {
|
||||
onlySSL = true;
|
||||
serverName = "matrix.${domain}";
|
||||
serverName = matrixDomain;
|
||||
useACMEHost = domain;
|
||||
|
||||
locations."/".return = "404";
|
||||
|
|
@ -171,7 +205,7 @@ in
|
|||
|
||||
locations."= /.well-known/matrix/server".extraConfig =
|
||||
let
|
||||
server = { "m.server" = "matrix.${domain}:${toString federationPort.public}"; };
|
||||
server = { "m.server" = "${matrixDomain}:${toString federationPort.public}"; };
|
||||
in
|
||||
''
|
||||
add_header Content-Type application/json;
|
||||
|
|
@ -181,7 +215,7 @@ in
|
|||
locations."= /.well-known/matrix/client".extraConfig =
|
||||
let
|
||||
client = {
|
||||
"m.homeserver" = { "base_url" = "https://matrix.${domain}"; };
|
||||
"m.homeserver" = { "base_url" = "https://${matrixDomain}"; };
|
||||
"m.identity_server" = { "base_url" = "https://vector.im"; };
|
||||
};
|
||||
# ACAO required to allow element-web on any URL to request this json file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue