Matrix: Difference between revisions

imported>Vojta001
m There is also Mirage client
Luflosi (talk | contribs)
m Fix deprecation of three options
 
(12 intermediate revisions by 11 users not shown)
Line 1: Line 1:
[https://matrix.org Matrix] defines a set of open APIs for decentralised communication, suitable for securely publishing, persisting and subscribing to data over a global open federation of servers with no single point of control. Uses include Instant Messaging (IM), Voice over IP (VoIP) signalling, Internet of Things (IoT) communication, and bridging together existing communication silos - providing the basis of a new open real-time communication ecosystem.
[https://matrix.org Matrix] defines a set of open APIs for decentralised communication, suitable for securely publishing, persisting and subscribing to data over a global open federation of servers with no single point of control. Uses include Instant Messaging (IM), Voice over IP (VoIP) signalling, Internet of Things (IoT) communication, and bridging together existing communication silos - providing the basis of a new open real-time communication ecosystem.
This article extends the documentation in [https://nixos.org/manual/nixos/stable/#module-services-matrix NixOS manual].


== NixOS Matrix channels ==
== NixOS Matrix channels ==
Line 15: Line 17:
A few Matrix desktop clients are packaged for NixOS.
A few Matrix desktop clients are packaged for NixOS.


* [https://search.nixos.org/packages/?query=element-desktop Element (formerly Riot, based on Electron)]
* [https://search.nixos.org/packages?query=element-desktop Element (formerly Riot, based on Electron)]
* [https://search.nixos.org/packages/?query=fractal Fractal]
* [https://search.nixos.org/packages?query=fractal Fractal]
* [https://search.nixos.org/packages/?query=gomuks gomuks]
* [https://search.nixos.org/packages?query=gomuks gomuks]
* [https://search.nixos.org/packages/?query=matrique matrique]
* [https://search.nixos.org/packages?query=neochat neochat]
* [https://search.nixos.org/packages/?query=mirage-im Mirage]
* [https://search.nixos.org/packages?query=mirage-im Mirage]
* [https://search.nixos.org/packages/?query=nheko nheko]
* [https://search.nixos.org/packages?query=nheko nheko]
* [https://search.nixos.org/packages/?query=quaternion Quaternion]
* [https://search.nixos.org/packages?query=quaternion Quaternion]
* [https://search.nixos.org/packages?query=iamb iamb]
 
A [https://search.nixos.org/packages?query=purple-matrix Pidgin / libpurple plugin] is also available.
 
==== Element ====
 
The [https://github.com/vector-im/element-web/blob/develop/config.sample.json config.json] file used by Element can be configured as such:


A [https://search.nixos.org/packages/?query=purple-matrix Pidgin / libpurple plugin] is also available.
<syntaxhighlight lang="nix">
nixpkgs.config.element-web.conf = {
  show_labs_settings = true;
  default_theme = "dark";
};
</syntaxhighlight>


=== Web clients ===
=== Web clients ===


There is also a web version of [https://search.nixos.org/packages/?query=element-web Element] which can be served using a web server. See [https://nixos.org/nixos/manual/index.html#module-services-matrix-element-web the NixOS manual entry].
There is also a web version of [https://search.nixos.org/packages?query=element-web Element] which can be served using a web server. See [https://nixos.org/nixos/manual/index.html#module-services-matrix-element-web the NixOS manual entry].


== Servers ==
== Servers ==
Line 35: Line 49:
==== Synapse ====
==== Synapse ====


Currently, only the reference Matrix homeserver [https://matrix.org/docs/projects/server/synapse Synapse] is  [https://search.nixos.org/packages/?query=matrix-synapse packaged] for NixOS. It has an associated module exposing the [https://search.nixos.org/options/?query=services.matrix-synapse services.matrix-synapse.* options]. See [https://nixos.org/nixos/manual/index.html#module-services-matrix-synapse the NixOS manual entry] for a complete configuration example.
Currently, only the reference Matrix homeserver [https://matrix.org/docs/projects/server/synapse Synapse] is  [https://search.nixos.org/packages?query=matrix-synapse packaged] for NixOS. It has an associated module exposing the [https://search.nixos.org/options?query=services.matrix-synapse services.matrix-synapse.* options]. See [https://nixos.org/nixos/manual/index.html#module-services-matrix-synapse the NixOS manual entry] for a complete configuration example.


===== Coturn with Synapse =====
===== Coturn with Synapse =====
Line 86: Line 100:
   networking.firewall = {
   networking.firewall = {
     interfaces.enp2s0 = let
     interfaces.enp2s0 = let
       range = with config.services.coturn; [ {
       range = with config.services.coturn; lib.singleton {
      from = min-port;
        from = min-port;
      to = max-port;
        to = max-port;
    } ];
      };
     in
     in
     {
     {
       allowedUDPPortRanges = range;
       allowedUDPPortRanges = range;
       allowedUDPPorts = [ 3478 ];
       allowedUDPPorts = [ 3478 5349 ];
       allowedTCPPortRanges = range;
       allowedTCPPortRanges = [ ];
       allowedTCPPorts = [ 3478 ];
       allowedTCPPorts = [ 3478 5349 ];
     };
     };
   };
   };
Line 105: Line 119:
   };
   };
   # configure synapse to point users to coturn
   # configure synapse to point users to coturn
   services.matrix-synapse = with config.services.coturn; {
   services.matrix-synapse.settings = with config.services.coturn; {
     turn_uris = ["turn:${realm}:3478?transport=udp" "turn:${realm}:3478?transport=tcp"];
     turn_uris = ["turn:${realm}:3478?transport=udp" "turn:${realm}:3478?transport=tcp"];
     turn_shared_secret = static-auth-secret;
     turn_shared_secret = static-auth-secret;
Line 112: Line 126:
}
}
</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) ===
Bridges allow you to connect Matrix to a third-party platform (like Discord, Telegram, etc.), and interact seamlessly. See [https://matrix.org/ecosystem/bridges/ here] for a list of currently supported bridges.


==== mautrix-telegram ====
==== mautrix-telegram ====
Line 126: Line 146:
   services.matrix-synapse = {
   services.matrix-synapse = {
     enable = true;
     enable = true;
     app_service_config_files = [
     settings.app_service_config_files = [
       # The registration file is automatically generated after starting the
       # The registration file is automatically generated after starting the
       # appservice for the first time.
       # appservice for the first time.
Line 199: Line 219:
==== mautrix-whatsapp ====
==== mautrix-whatsapp ====


Packaged as [https://search.nixos.org/packages/?query=mautrix-whatsapp mautrix-whatsapp].
Packaged as [https://search.nixos.org/packages?query=mautrix-whatsapp mautrix-whatsapp].
[https://github.com/NixOS/nixpkgs/pull/59211 Module still a WIP].
Module implemented in this [https://github.com/NixOS/nixpkgs/pull/246842 PR].


==== matrix-appservice-irc ====
==== matrix-appservice-irc ====
Line 308: Line 328:


== See also ==
== See also ==
 
* [[Mjolnir]] - a Matrix moderation tool
* [https://nixos.org/nixos/manual/index.html#module-services-matrix The chapter about Matrix in the NixOS manual]
* [https://matrix.to/#/!vxTmkuJzhGPsMdkAOc:transformierende-gesellschaft.org?via=transformierende-gesellschaft.org The Nix Matrix Subsystem chat room, on Matrix]
* [https://matrix.to/#/!vxTmkuJzhGPsMdkAOc:transformierende-gesellschaft.org?via=transformierende-gesellschaft.org The Nix Matrix Subsystem chat room, on Matrix]


[[Category:Applications]]
[[Category:Applications]]
[[Category:Server]]
[[Category:NixOS Manual]]