1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-30 01:20:40 +00:00
nixpkgs/pkgs/servers/xmpp/prosody/default.nix

91 lines
2.6 KiB
Nix
Raw Normal View History

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
2020-04-20 19:27:53 +01:00
{ stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg
, lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop
2020-05-24 20:05:42 +01:00
, nixosTests
, withLibevent ? true, luaevent ? null
, withDBI ? true, luadbi ? null
# use withExtraLibs to add additional dependencies of community modules
, withExtraLibs ? [ ]
2018-03-22 02:40:46 +00:00
, withOnlyInstalledCommunityModules ? [ ]
, withCommunityModules ? [ ] }:
2015-02-19 11:09:38 +00:00
assert withLibevent -> luaevent != null;
assert withDBI -> luadbi != null;
2015-02-19 11:09:38 +00:00
with stdenv.lib;
stdenv.mkDerivation rec {
2020-10-05 14:22:16 +01:00
version = "0.11.7"; # also update communityModules
pname = "prosody";
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
2020-04-20 19:27:53 +01:00
# 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";
2020-10-05 14:22:16 +01:00
sha256 = "0iw73ids6lv09pg2fn0cxsm2pvi593md71xk48zbcp28advc1zr8";
};
# A note to all those merging automated updates: Please also update this
# attribute as some modules might not be compatible with a newer prosody
# version.
2014-10-15 02:57:00 +01:00
communityModules = fetchhg {
url = "https://hg.prosody.im/prosody-modules";
2020-10-05 14:22:16 +01:00
rev = "7678b4880719";
sha256 = "1rpk3jcfhsa9hl7d7y638kprs9in0ljjp1nqxg30w1689v5h85d2";
2014-10-15 02:57:00 +01:00
};
luaPackages: Replace all rockspec packages with generated ones luaPackages replaced by generated ones: - bit32 - compat53 - cqueues - luacyrussasl -> cyrussasl (luarocks name) - luaexpat - luadbi -> luadbi front-end module + separate backend modules luadbi-{mysql,postgresql,sqlite3} - luafilesystem - luaossl - luasec - luasocket - luastdlib -> stdlib (luarocks name) - lrexlib -> lrexlib-pcre (we already have lrexlib-gnu and lrexlib-posix, lrexlib-pcre however appears to be the variant used in mudlet, which is the only current dep in nixpkgs) - luasqlite -> luasql-sqlite3 (luarocks name) - lfs -> luafilesytem (we literally had two manually written luafilesystem expressions, under different names) Changes and additions to overrides to generated luarocks packgaes, including: - busted: Install bash completions along with the zsh ones - cqueues: - Perform minor surgery on the rockspec to allow using a single rockspec to build for all supported Lua versions - Add a patch by @vcunat to work around a build issue - luuid: Wrote a tiny patch to allow for Lua 5.1/Luajit compatibility - General changes: - Sorted the packages - Attempted to make the formatting consistent - Preferenced `.override` instead of `.overrideAttrs` wherever possible Minor changes to other packages to adjust for the Lua package changes: - luakit expression simplified - prosody expression simplified; but users will now need to specify the luadbi backend module they intend to use in withExtraLibs - knot-resolver inputs correctd - mudlet inputs corrected (although this package was and should still be broken)
2019-06-13 12:01:10 +01:00
buildInputs = [
lua5 makeWrapper libidn openssl
]
# Lua libraries
++ [
luasocket luasec luaexpat luafilesystem luabitop
]
++ optional withLibevent luaevent
++ optional withDBI luadbi
++ withExtraLibs;
configureFlags = [
"--ostype=linux"
"--with-lua-include=${lua5}/include"
"--with-lua=${lua5}"
];
postInstall = ''
${concatMapStringsSep "\n" (module: ''
cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
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
2020-04-20 19:27:53 +01:00
'') (lib.lists.unique(nixosModuleDeps ++ withCommunityModules ++ withOnlyInstalledCommunityModules))}
wrapProgram $out/bin/prosody \
--prefix LUA_PATH ';' "$LUA_PATH" \
--prefix LUA_CPATH ';' "$LUA_CPATH"
wrapProgram $out/bin/prosodyctl \
--add-flags '--config "/etc/prosody/prosody.cfg.lua"' \
--prefix LUA_PATH ';' "$LUA_PATH" \
--prefix LUA_CPATH ';' "$LUA_CPATH"
'';
2020-05-24 20:05:42 +01:00
passthru = {
communityModules = withCommunityModules;
tests = {
main = nixosTests.prosody;
mysql = nixosTests.prosodyMysql;
};
};
2018-03-22 02:40:46 +00:00
meta = {
description = "Open-source XMPP application server written in Lua";
2015-02-19 11:09:38 +00:00
license = licenses.mit;
homepage = "https://prosody.im";
2015-02-19 11:09:38 +00:00
platforms = platforms.linux;
maintainers = with maintainers; [ fpletz globin ninjatrappeur ];
};
}