2023-10-09 19:29:22 +00:00
|
|
|
{ stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg, buildPackages
|
2022-04-27 09:35:20 +00:00
|
|
|
, icu
|
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
|
|
|
, 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; [
|
2022-04-27 09:35:20 +00:00
|
|
|
luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3 luaunbound
|
2021-09-18 10:52:07 +00:00
|
|
|
]
|
|
|
|
++ 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 {
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.12.4"; # 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 = [
|
|
|
|
"cloud_notify"
|
|
|
|
"vcard_muc"
|
|
|
|
"http_upload"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://prosody.im/downloads/source/${pname}-${version}.tar.gz";
|
2023-10-09 19:29:22 +00:00
|
|
|
sha256 = "R9cSJzwvKVWMQS9s2uwHMmC7wmt92iQ9tYAzAYPWWFY=";
|
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";
|
2023-10-09 19:29:22 +00:00
|
|
|
rev = "7c105277a9ca";
|
|
|
|
sha256 = "eiObn5Kw7dS+oxdQiJ8NhSC4P7EvILIOEnMoxCWIFro=";
|
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 = [
|
2022-04-27 09:35:20 +00:00
|
|
|
luaEnv libidn openssl icu
|
2020-04-24 23:36:52 +00:00
|
|
|
]
|
|
|
|
++ withExtraLibs;
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--ostype=linux"
|
2023-10-09 19:29:22 +00:00
|
|
|
"--with-lua-bin=${lib.getBin buildPackages.lua}/bin"
|
2021-09-18 10:52:07 +00:00
|
|
|
"--with-lua-include=${luaEnv}/include"
|
|
|
|
"--with-lua=${luaEnv}"
|
2023-10-09 19:29:22 +00:00
|
|
|
"--c-compiler=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"--linker=${stdenv.cc.targetPrefix}cc"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2023-10-09 19:29:22 +00:00
|
|
|
configurePlatforms = [];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
postBuild = ''
|
|
|
|
make -C tools/migration
|
|
|
|
'';
|
|
|
|
|
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/prosodyctl \
|
2022-04-27 09:35:20 +00:00
|
|
|
--add-flags '--config "/etc/prosody/prosody.cfg.lua"'
|
2020-11-03 02:18:15 +00:00
|
|
|
make -C tools/migration install
|
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;
|
2023-11-16 04:20:00 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|