2020-05-03 17:38:23 +00:00
|
|
|
{ stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg
|
2021-09-18 10:52:07 +00:00
|
|
|
, lua
|
2020-05-29 06:06:01 +00:00
|
|
|
, nixosTests
|
2021-09-18 10:52:07 +00:00
|
|
|
, withLibevent ? true
|
|
|
|
, withDBI ? true
|
2020-04-24 23:36:52 +00:00
|
|
|
# use withExtraLibs to add additional dependencies of community modules
|
|
|
|
, withExtraLibs ? [ ]
|
2022-02-20 05:27:41 +00:00
|
|
|
, withExtraLuaPackages ? _: [ ]
|
2020-04-24 23:36:52 +00:00
|
|
|
, withOnlyInstalledCommunityModules ? [ ]
|
|
|
|
, withCommunityModules ? [ ] }:
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
let
|
|
|
|
luaEnv = lua.withPackages(p: with p; [
|
|
|
|
luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3
|
|
|
|
]
|
|
|
|
++ lib.optional withLibevent p.luaevent
|
|
|
|
++ lib.optional withDBI p.luadbi
|
2022-02-20 05:27:41 +00:00
|
|
|
++ withExtraLuaPackages p
|
2021-09-18 10:52:07 +00:00
|
|
|
);
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2022-03-30 09:31:56 +00:00
|
|
|
version = "0.11.13"; # also update communityModules
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "prosody";
|
2020-05-03 17:38:23 +00: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"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://prosody.im/downloads/source/${pname}-${version}.tar.gz";
|
2022-03-30 09:31:56 +00:00
|
|
|
sha256 = "sha256-OcYbNGoJtRJbYEy5aeFCBsu8uGyBFW/8a6LWJSfPBDI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
communityModules = fetchhg {
|
|
|
|
url = "https://hg.prosody.im/prosody-modules";
|
2022-03-30 09:31:56 +00:00
|
|
|
rev = "54fa2116bbf3";
|
|
|
|
sha256 = "sha256-OKZ7tD75q8/GMXruUQ+r9l0BxzdbPHNf41fZ3fHVQVw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
2021-09-18 10:52:07 +00:00
|
|
|
luaEnv libidn openssl
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
|
|
|
++ withExtraLibs;
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--ostype=linux"
|
2021-09-18 10:52:07 +00:00
|
|
|
"--with-lua-include=${luaEnv}/include"
|
|
|
|
"--with-lua=${luaEnv}"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
postBuild = ''
|
|
|
|
make -C tools/migration
|
|
|
|
'';
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
luaEnvPath = lua.pkgs.lib.genLuaPathAbsStr luaEnv;
|
|
|
|
luaEnvCPath = lua.pkgs.lib.genLuaCPathAbsStr luaEnv;
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# the wrapping should go away once lua hook is fixed
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
${concatMapStringsSep "\n" (module: ''
|
|
|
|
cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
|
2020-05-03 17:38:23 +00:00
|
|
|
'') (lib.lists.unique(nixosModuleDeps ++ withCommunityModules ++ withOnlyInstalledCommunityModules))}
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/bin/prosody \
|
2022-04-15 01:41:22 +00:00
|
|
|
--prefix LUA_PATH ';' "$luaEnvPath" \
|
|
|
|
--prefix LUA_CPATH ';' "$luaEnvCPath"
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/bin/prosodyctl \
|
|
|
|
--add-flags '--config "/etc/prosody/prosody.cfg.lua"' \
|
2022-04-15 01:41:22 +00:00
|
|
|
--prefix LUA_PATH ';' "$luaEnvPath" \
|
|
|
|
--prefix LUA_CPATH ';' "$luaEnvCPath"
|
2020-11-03 02:18:15 +00:00
|
|
|
|
|
|
|
make -C tools/migration install
|
|
|
|
wrapProgram $out/bin/prosody-migrator \
|
2022-04-15 01:41:22 +00:00
|
|
|
--prefix LUA_PATH ';' "$luaEnvPath" \
|
|
|
|
--prefix LUA_CPATH ';' "$luaEnvCPath"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
passthru = {
|
|
|
|
communityModules = withCommunityModules;
|
2022-03-30 09:31:56 +00:00
|
|
|
tests = { inherit (nixosTests) prosody prosody-mysql; };
|
2020-05-29 06:06:01 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Open-source XMPP application server written in Lua";
|
|
|
|
license = licenses.mit;
|
|
|
|
homepage = "https://prosody.im";
|
|
|
|
platforms = platforms.linux;
|
2020-09-25 04:45:31 +00:00
|
|
|
maintainers = with maintainers; [ fpletz globin ninjatrappeur ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|