···11+# Prosody {#module-services-prosody}
22+33+[Prosody](https://prosody.im/) is an open-source, modern XMPP server.
44+55+## Basic usage {#module-services-prosody-basic-usage}
66+77+A common struggle for most XMPP newcomers is to find the right set
88+of XMPP Extensions (XEPs) to setup. Forget to activate a few of
99+those and your XMPP experience might turn into a nightmare!
1010+1111+The XMPP community tackles this problem by creating a meta-XEP
1212+listing a decent set of XEPs you should implement. This meta-XEP
1313+is issued every year, the 2020 edition being
1414+[XEP-0423](https://xmpp.org/extensions/xep-0423.html).
1515+1616+The NixOS Prosody module will implement most of these recommendend XEPs out of
1717+the box. That being said, two components still require some
1818+manual configuration: the
1919+[Multi User Chat (MUC)](https://xmpp.org/extensions/xep-0045.html)
2020+and the [HTTP File Upload](https://xmpp.org/extensions/xep-0363.html) ones.
2121+You'll need to create a DNS subdomain for each of those. The current convention is to name your
2222+MUC endpoint `conference.example.org` and your HTTP upload domain `upload.example.org`.
2323+2424+A good configuration to start with, including a
2525+[Multi User Chat (MUC)](https://xmpp.org/extensions/xep-0045.html)
2626+endpoint as well as a [HTTP File Upload](https://xmpp.org/extensions/xep-0363.html)
2727+endpoint will look like this:
2828+```
2929+services.prosody = {
3030+ enable = true;
3131+ admins = [ "root@example.org" ];
3232+ ssl.cert = "/var/lib/acme/example.org/fullchain.pem";
3333+ ssl.key = "/var/lib/acme/example.org/key.pem";
3434+ virtualHosts."example.org" = {
3535+ enabled = true;
3636+ domain = "example.org";
3737+ ssl.cert = "/var/lib/acme/example.org/fullchain.pem";
3838+ ssl.key = "/var/lib/acme/example.org/key.pem";
3939+ };
4040+ muc = [ {
4141+ domain = "conference.example.org";
4242+ } ];
4343+ uploadHttp = {
4444+ domain = "upload.example.org";
4545+ };
4646+};
4747+```
4848+4949+## Let's Encrypt Configuration {#module-services-prosody-letsencrypt}
5050+5151+As you can see in the code snippet from the
5252+[previous section](#module-services-prosody-basic-usage),
5353+you'll need a single TLS certificate covering your main endpoint,
5454+the MUC one as well as the HTTP Upload one. We can generate such a
5555+certificate by leveraging the ACME
5656+[extraDomainNames](#opt-security.acme.certs._name_.extraDomainNames) module option.
5757+5858+Provided the setup detailed in the previous section, you'll need the following acme configuration to generate
5959+a TLS certificate for the three endponits:
6060+```
6161+security.acme = {
6262+ email = "root@example.org";
6363+ acceptTerms = true;
6464+ certs = {
6565+ "example.org" = {
6666+ webroot = "/var/www/example.org";
6767+ email = "root@example.org";
6868+ extraDomainNames = [ "conference.example.org" "upload.example.org" ];
6969+ };
7070+ };
7171+};
7272+```
+3
nixos/modules/services/networking/prosody.nix
···904904 };
905905906906 };
907907+908908+ # Don't edit the docbook xml directly, edit the md and generate it:
909909+ # `pandoc prosody.md -t docbook --top-level-division=chapter --extract-media=media -f markdown-smart --lua-filter ../../../../doc/build-aux/pandoc-filters/myst-reader/roles.lua --lua-filter ../../../../doc/build-aux/pandoc-filters/docbook-writer/rst-roles.lua > prosody.xml`
907910 meta.doc = ./prosody.xml;
908911}
+68-67
nixos/modules/services/networking/prosody.xml
···11-<chapter xmlns="http://docbook.org/ns/docbook"
22- xmlns:xlink="http://www.w3.org/1999/xlink"
33- xmlns:xi="http://www.w3.org/2001/XInclude"
44- version="5.0"
55- xml:id="module-services-prosody">
66- <title>Prosody</title>
77- <para>
88- <link xlink:href="https://prosody.im/">Prosody</link> is an open-source, modern XMPP server.
99- </para>
1010- <section xml:id="module-services-prosody-basic-usage">
1111- <title>Basic usage</title>
1212-1313- <para>
1414- A common struggle for most XMPP newcomers is to find the right set
1515- of XMPP Extensions (XEPs) to setup. Forget to activate a few of
1616- those and your XMPP experience might turn into a nightmare!
1717- </para>
1818-11+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="module-services-prosody">
22+ <title>Prosody</title>
193 <para>
2020- The XMPP community tackles this problem by creating a meta-XEP
2121- listing a decent set of XEPs you should implement. This meta-XEP
2222- is issued every year, the 2020 edition being
2323- <link xlink:href="https://xmpp.org/extensions/xep-0423.html">XEP-0423</link>.
2424- </para>
2525- <para>
2626- The NixOS Prosody module will implement most of these recommendend XEPs out of
2727- the box. That being said, two components still require some
2828- manual configuration: the
2929- <link xlink:href="https://xmpp.org/extensions/xep-0045.html">Multi User Chat (MUC)</link>
3030- and the <link xlink:href="https://xmpp.org/extensions/xep-0363.html">HTTP File Upload</link> ones.
3131- You'll need to create a DNS subdomain for each of those. The current convention is to name your
3232- MUC endpoint <literal>conference.example.org</literal> and your HTTP upload domain <literal>upload.example.org</literal>.
44+ <link xlink:href="https://prosody.im/">Prosody</link> is an
55+ open-source, modern XMPP server.
336 </para>
3434- <para>
3535- A good configuration to start with, including a
3636- <link xlink:href="https://xmpp.org/extensions/xep-0045.html">Multi User Chat (MUC)</link>
3737- endpoint as well as a <link xlink:href="https://xmpp.org/extensions/xep-0363.html">HTTP File Upload</link>
3838- endpoint will look like this:
77+ <section xml:id="module-services-prosody-basic-usage">
88+ <title>Basic usage</title>
99+ <para>
1010+ A common struggle for most XMPP newcomers is to find the right set
1111+ of XMPP Extensions (XEPs) to setup. Forget to activate a few of
1212+ those and your XMPP experience might turn into a nightmare!
1313+ </para>
1414+ <para>
1515+ The XMPP community tackles this problem by creating a meta-XEP
1616+ listing a decent set of XEPs you should implement. This meta-XEP
1717+ is issued every year, the 2020 edition being
1818+ <link xlink:href="https://xmpp.org/extensions/xep-0423.html">XEP-0423</link>.
1919+ </para>
2020+ <para>
2121+ The NixOS Prosody module will implement most of these recommendend
2222+ XEPs out of the box. That being said, two components still require
2323+ some manual configuration: the
2424+ <link xlink:href="https://xmpp.org/extensions/xep-0045.html">Multi
2525+ User Chat (MUC)</link> and the
2626+ <link xlink:href="https://xmpp.org/extensions/xep-0363.html">HTTP
2727+ File Upload</link> ones. You'll need to create a DNS subdomain for
2828+ each of those. The current convention is to name your MUC endpoint
2929+ <literal>conference.example.org</literal> and your HTTP upload
3030+ domain <literal>upload.example.org</literal>.
3131+ </para>
3232+ <para>
3333+ A good configuration to start with, including a
3434+ <link xlink:href="https://xmpp.org/extensions/xep-0045.html">Multi
3535+ User Chat (MUC)</link> endpoint as well as a
3636+ <link xlink:href="https://xmpp.org/extensions/xep-0363.html">HTTP
3737+ File Upload</link> endpoint will look like this:
3838+ </para>
3939 <programlisting>
4040services.prosody = {
4141 enable = true;
4242- admins = [ "root@example.org" ];
4343- ssl.cert = "/var/lib/acme/example.org/fullchain.pem";
4444- ssl.key = "/var/lib/acme/example.org/key.pem";
4545- virtualHosts."example.org" = {
4242+ admins = [ "root@example.org" ];
4343+ ssl.cert = "/var/lib/acme/example.org/fullchain.pem";
4444+ ssl.key = "/var/lib/acme/example.org/key.pem";
4545+ virtualHosts."example.org" = {
4646 enabled = true;
4747- domain = "example.org";
4848- ssl.cert = "/var/lib/acme/example.org/fullchain.pem";
4949- ssl.key = "/var/lib/acme/example.org/key.pem";
4747+ domain = "example.org";
4848+ ssl.cert = "/var/lib/acme/example.org/fullchain.pem";
4949+ ssl.key = "/var/lib/acme/example.org/key.pem";
5050 };
5151 muc = [ {
5252- domain = "conference.example.org";
5252+ domain = "conference.example.org";
5353 } ];
5454 uploadHttp = {
5555- domain = "upload.example.org";
5555+ domain = "upload.example.org";
5656 };
5757};
5858</programlisting>
5959- </para>
6060- </section>
6161- <section xml:id="module-services-prosody-letsencrypt">
6262- <title>Let's Encrypt Configuration</title>
6363- <para>
6464- As you can see in the code snippet from the
6565- <link linkend="module-services-prosody-basic-usage">previous section</link>,
6666- you'll need a single TLS certificate covering your main endpoint,
6767- the MUC one as well as the HTTP Upload one. We can generate such a
6868- certificate by leveraging the ACME
6969- <link linkend="opt-security.acme.certs._name_.extraDomainNames">extraDomainNames</link> module option.
7070- </para>
7171- <para>
7272- Provided the setup detailed in the previous section, you'll need the following acme configuration to generate
7373- a TLS certificate for the three endponits:
5959+ </section>
6060+ <section xml:id="module-services-prosody-letsencrypt">
6161+ <title>Let's Encrypt Configuration</title>
6262+ <para>
6363+ As you can see in the code snippet from the
6464+ <link linkend="module-services-prosody-basic-usage">previous
6565+ section</link>, you'll need a single TLS certificate covering your
6666+ main endpoint, the MUC one as well as the HTTP Upload one. We can
6767+ generate such a certificate by leveraging the ACME
6868+ <link linkend="opt-security.acme.certs._name_.extraDomainNames">extraDomainNames</link>
6969+ module option.
7070+ </para>
7171+ <para>
7272+ Provided the setup detailed in the previous section, you'll need
7373+ the following acme configuration to generate a TLS certificate for
7474+ the three endponits:
7575+ </para>
7476 <programlisting>
7577security.acme = {
7676- email = "root@example.org";
7878+ email = "root@example.org";
7779 acceptTerms = true;
7880 certs = {
7979- "example.org" = {
8080- webroot = "/var/www/example.org";
8181- email = "root@example.org";
8282- extraDomainNames = [ "conference.example.org" "upload.example.org" ];
8181+ "example.org" = {
8282+ webroot = "/var/www/example.org";
8383+ email = "root@example.org";
8484+ extraDomainNames = [ "conference.example.org" "upload.example.org" ];
8385 };
8486 };
8587};
8688</programlisting>
8787- </para>
8888-</section>
8989+ </section>
8990</chapter>