summary refs log tree commit diff
path: root/pkgs/servers/xmpp
diff options
context:
space:
mode:
authorFélix Baylac-Jacqué <felix@alternativebit.fr>2020-04-20 20:27:53 +0200
committerFélix Baylac-Jacqué <felix@alternativebit.fr>2020-04-30 20:39:54 +0200
commit8aea5288725688f7f71bf12c8ee1bb83147b22c6 (patch)
tree6803897e41ad3d7316e6e9897ea6fab2bb94edd2 /pkgs/servers/xmpp
parent5e4abf76c7e74660369bcb5e2648746db03142c8 (diff)
downloadnixpkgs-8aea5288725688f7f71bf12c8ee1bb83147b22c6.tar
nixpkgs-8aea5288725688f7f71bf12c8ee1bb83147b22c6.tar.gz
nixpkgs-8aea5288725688f7f71bf12c8ee1bb83147b22c6.tar.bz2
nixpkgs-8aea5288725688f7f71bf12c8ee1bb83147b22c6.tar.lz
nixpkgs-8aea5288725688f7f71bf12c8ee1bb83147b22c6.tar.xz
nixpkgs-8aea5288725688f7f71bf12c8ee1bb83147b22c6.tar.zst
nixpkgs-8aea5288725688f7f71bf12c8ee1bb83147b22c6.zip
nixos/prosody: make defaults comply with XEP-0423
Setting up a XMPP chat server is a pretty deep rabbit whole to jump in
when you're not familiar with this whole universe. Your experience
with this environment will greatly depends on whether or not your
server implements the right set of XEPs.

To tackle this problem, the XMPP community came with the idea of
creating a meta-XEP in charge of listing the desirable XEPs to comply
with. This meta-XMP is issued every year under an new XEP number. The
2020 one being XEP-0423[1].

This prosody nixos module refactoring makes complying with XEP-0423
easier. All the necessary extensions are enabled by default. For some
extensions (MUC and HTTP_UPLOAD), we need some input from the user and
cannot provide a sensible default nixpkgs-wide. For those, we guide
the user using a couple of assertions explaining the remaining manual
steps to perform.

We took advantage of this substential refactoring to refresh the
associated nixos test.

Changelog:
- Update the prosody package to provide the necessary community
  modules in order to comply with XEP-0423. This is a tradeoff, as
  depending on their configuration, the user might end up not using them
  and wasting some disk space. That being said, adding those will
  allow the XEP-0423 users, which I expect to be the majority of
  users, to leverage a bit more the binary cache.
- Add a muc submodule populated with the prosody muc defaults.
- Add a http_upload submodule in charge of setting up a basic http
  server handling the user uploads. This submodule is in is
  spinning up an HTTP(s) server in charge of receiving and serving the
  user's attachments.
- Advertise both the MUCs and the http_upload endpoints using mod disco.
- Use the slixmpp library in place of the now defunct sleekxmpp for
  the prosody NixOS test.
- Update the nixos test to setup and test the MUC and http upload
  features.
- Add a couple of assertions triggered if the setup is not xep-0423
  compliant.

[1] https://xmpp.org/extensions/xep-0423.html
Diffstat (limited to 'pkgs/servers/xmpp')
-rw-r--r--pkgs/servers/xmpp/prosody/default.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/pkgs/servers/xmpp/prosody/default.nix b/pkgs/servers/xmpp/prosody/default.nix
index 0d552e9e112..702da004b42 100644
--- a/pkgs/servers/xmpp/prosody/default.nix
+++ b/pkgs/servers/xmpp/prosody/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libidn, openssl, makeWrapper, fetchhg
+{ stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg
 , lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop
 , withLibevent ? true, luaevent ? null
 , withDBI ? true, luadbi ? null
@@ -16,7 +16,16 @@ with stdenv.lib;
 stdenv.mkDerivation rec {
   version = "0.11.5"; # also update communityModules
   pname = "prosody";
-
+  # The following community modules are necessary for the nixos module
+  # prosody module to comply with XEP-0423 and provide a working
+  # default setup.
+  nixosModuleDeps = [
+    "bookmarks"
+    "cloud_notify"
+    "vcard_muc"
+    "smacks"
+    "http_upload"
+  ];
   src = fetchurl {
     url = "https://prosody.im/downloads/source/${pname}-${version}.tar.gz";
     sha256 = "12s0hn6hvjbi61cdw3165l6iw0878971dmlvfg663byjsmjvvy2m";
@@ -52,7 +61,7 @@ stdenv.mkDerivation rec {
   postInstall = ''
       ${concatMapStringsSep "\n" (module: ''
         cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
-      '') (withCommunityModules ++ withOnlyInstalledCommunityModules)}
+      '') (lib.lists.unique(nixosModuleDeps ++ withCommunityModules ++ withOnlyInstalledCommunityModules))}
       wrapProgram $out/bin/prosody \
         --prefix LUA_PATH ';' "$LUA_PATH" \
         --prefix LUA_CPATH ';' "$LUA_CPATH"