Matrix: Difference between revisions

m disable livekit auto room creation as per lk-jwt-service upstream docs
Zimward (talk | contribs)
Move Livekit out of the synapse section as its homeserver independent
 
(2 intermediate revisions by 2 users not shown)
Line 165: Line 165:
</syntaxhighlight>
</syntaxhighlight>


==== Livekit ====
 
 
==== Synapse with Workers ====
There's an external module to automatically set up synapse and configure nginx with workers:
https://github.com/dali99/nixos-matrix-modules
 
==== Synapse Admin with Caddy ====
Setting up [https://github.com/etkecc/synapse-admin Synapse Admin] with [[Caddy]] is quite easy!
 
The example uses the newer <code>pkgs.synapse-admin-etkecc</code> which may not be what you want if you have heard of the old one which is available at: <code>pkgs.synapse-admin</code>
{{File|3={ pkgs, ... }:
let
  synapse-admin = pkgs.synapse-admin-etkecc.withConfig {
    restrictBaseUrl = [
      "https://matrix.example.com" # Synapse domain
    ];
  };
in
{
  services.caddy.virtualHosts."synapse-admin.example.com".extraConfig = ''
    root * ${synapse-admin}
    file_server
  '';
}|name=/etc/nixos/configuration.nix|lang=nix}}
== Homeserver Independent ==
=== Livekit ===
In order to set up element call or for calls to work in Element X it is necessary to set up and announce livekit. To set up livekit for matrix in nixos use<syntaxhighlight lang="nix" line="1">
In order to set up element call or for calls to work in Element X it is necessary to set up and announce livekit. To set up livekit for matrix in nixos use<syntaxhighlight lang="nix" line="1">
{ config, lib, pkgs, ... }: let
{ config, lib, pkgs, ... }: let
Line 188: Line 213:
     path = with pkgs; [ livekit coreutils gawk ];
     path = with pkgs; [ livekit coreutils gawk ];
     script = ''
     script = ''
      if [ -f ${keyFile} ]; then
        echo "Key exists"
      else
         echo "Key missing, generating key"
         echo "Key missing, generating key"
         echo "lk-jwt-service: $(livekit-server generate-keys | tail -1 | awk '{print $3}')" > "${keyFile}"
         echo "lk-jwt-service: $(livekit-server generate-keys | tail -1 | awk '{print $3}')" > "${keyFile}"
      fi
     '';
     '';
     serviceConfig.Type = "oneshot";
     serviceConfig.Type = "oneshot";
    unitConfig.ConditionPathExists = "!${keyFile}";
   };
   };
   # restrict access to livekit room creation to a homeserver
   # restrict access to livekit room creation to a homeserver
Line 238: Line 260:
}
}
</syntaxhighlight>
</syntaxhighlight>
==== Synapse with Workers ====
There's an external module to automatically set up synapse and configure nginx with workers:
https://github.com/dali99/nixos-matrix-modules


== Application services (a.k.a. bridges) ==
== Application services (a.k.a. bridges) ==