prosody: support for DBI, extra community modules and extra Lua libraries

This commit is contained in:
Satoshi Shishiku 2017-03-01 00:57:02 +00:00 committed by Florian Jacob
parent 7d0b910361
commit 988ce5433f
2 changed files with 19 additions and 11 deletions

View File

@ -1,16 +1,24 @@
{ stdenv, fetchurl, libidn, openssl, makeWrapper, fetchhg { stdenv, fetchurl, libidn, openssl, makeWrapper, fetchhg
, lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop, luaevent ? null, luazlib ? null , lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop
, withLibevent ? true, withZlib ? true }: , withLibevent ? true, luaevent ? null
, withZlib ? true, luazlib ? null
, withDBI ? true, luadbi ? null
# use withExtraLibs to add additional dependencies of community modules
, withExtraLibs ? [ ]
, withCommunityModules ? [ ] }:
assert withLibevent -> luaevent != null; assert withLibevent -> luaevent != null;
assert withZlib -> luazlib != null; assert withZlib -> luazlib != null;
assert withDBI -> luadbi != null;
with stdenv.lib; with stdenv.lib;
let let
libs = [ luasocket luasec luaexpat luafilesystem luabitop ] libs = [ luasocket luasec luaexpat luafilesystem luabitop ]
++ optional withLibevent luaevent ++ optional withLibevent luaevent
++ optional withZlib luazlib; ++ optional withZlib luazlib
++ optional withDBI luadbi
++ withExtraLibs;
getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}"; getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}";
getLuaPath = lib : getPath lib "lua"; getLuaPath = lib : getPath lib "lua";
getLuaCPath = lib : getPath lib "so"; getLuaCPath = lib : getPath lib "so";
@ -28,14 +36,12 @@ stdenv.mkDerivation rec {
}; };
communityModules = fetchhg { communityModules = fetchhg {
url = "http://prosody-modules.googlecode.com/hg/"; url = "https://hg.prosody.im/prosody-modules";
rev = "4b55110b0aa8"; rev = "590ac12b7671";
sha256 = "0010x2rl9f9ihy2nwqan2jdlz25433srj2zna1xh10490mc28hij"; sha256 = "02f3nmvbidm2f32v6kvc1ljmslysgk0ab2lpg91szy0agmmj5xja";
}; };
buildInputs = [ lua5 luasocket luasec luaexpat luabitop libidn openssl makeWrapper ] buildInputs = [ lua5 makeWrapper libidn openssl ];
++ optional withLibevent luaevent
++ optional withZlib luazlib;
configureFlags = [ configureFlags = [
"--ostype=linux" "--ostype=linux"
@ -44,7 +50,9 @@ stdenv.mkDerivation rec {
]; ];
postInstall = '' postInstall = ''
cp $communityModules/mod_websocket/mod_websocket.lua $out/lib/prosody/modules/ ${concatMapStringsSep "\n" (module: ''
cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
'') withCommunityModules}
wrapProgram $out/bin/prosody \ wrapProgram $out/bin/prosody \
--set LUA_PATH '${luaPath};' \ --set LUA_PATH '${luaPath};' \
--set LUA_CPATH '${luaCPath};' --set LUA_CPATH '${luaCPath};'

View File

@ -11498,7 +11498,7 @@ with pkgs;
prosody = callPackage ../servers/xmpp/prosody { prosody = callPackage ../servers/xmpp/prosody {
lua5 = lua5_1; lua5 = lua5_1;
inherit (lua51Packages) luasocket luasec luaexpat luafilesystem luabitop luaevent luazlib; inherit (lua51Packages) luasocket luasec luaexpat luafilesystem luabitop luaevent luazlib luadbi;
}; };
biboumi = callPackage ../servers/xmpp/biboumi { }; biboumi = callPackage ../servers/xmpp/biboumi { };