@@ -1,16 +1,24 @@
11{ stdenv, fetchurl, libidn, openssl, makeWrapper, fetchhg
2−, lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop, luaevent ? null, luazlib ? null
3−, withLibevent ? true, withZlib ? true }:
2+, lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop
3+, withLibevent ? true, luaevent ? null
4+, withZlib ? true, luazlib ? null
5+, withDBI ? true, luadbi ? null
6+# use withExtraLibs to add additional dependencies of community modules
7+, withExtraLibs ? [ ]
8+, withCommunityModules ? [ ] }:
49
510assert withLibevent -> luaevent != null;
611assert withZlib -> luazlib != null;
12+assert withDBI -> luadbi != null;
713
814with stdenv.lib;
915
1016let
1117 libs = [ luasocket luasec luaexpat luafilesystem luabitop ]
1218 ++ optional withLibevent luaevent
13− ++ optional withZlib luazlib;
19+ ++ optional withZlib luazlib
20+ ++ optional withDBI luadbi
21+ ++ withExtraLibs;
1422 getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}";
1523 getLuaPath = lib : getPath lib "lua";
1624 getLuaCPath = lib : getPath lib "so";
@@ -28,14 +36,12 @@ stdenv.mkDerivation rec {
2836 };
2937
3038 communityModules = fetchhg {
31− url = "http://prosody-modules.googlecode.com/hg/";
32− rev = "4b55110b0aa8";
33− sha256 = "0010x2rl9f9ihy2nwqan2jdlz25433srj2zna1xh10490mc28hij";
39+ url = "https://hg.prosody.im/prosody-modules";
40+ rev = "590ac12b7671";
41+ sha256 = "02f3nmvbidm2f32v6kvc1ljmslysgk0ab2lpg91szy0agmmj5xja";
3442 };
3543
36− buildInputs = [ lua5 luasocket luasec luaexpat luabitop libidn openssl makeWrapper ]
37− ++ optional withLibevent luaevent
38− ++ optional withZlib luazlib;
44+ buildInputs = [ lua5 makeWrapper libidn openssl ];
3945
4046 configureFlags = [
4147 "--ostype=linux"
@@ -44,7 +50,9 @@ stdenv.mkDerivation rec {
4450 ];
4551
4652 postInstall = ''
47− cp $communityModules/mod_websocket/mod_websocket.lua $out/lib/prosody/modules/
53+ ${concatMapStringsSep "\n" (module: ''
54+ cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
55+ '') withCommunityModules}
4856 wrapProgram $out/bin/prosody \
4957 --set LUA_PATH '${luaPath};' \
5058 --set LUA_CPATH '${luaCPath};'