diff options
| -rw-r--r-- | customized/prosody.nix | 27 | 
1 files changed, 15 insertions, 12 deletions
| diff --git a/customized/prosody.nix b/customized/prosody.nix index 80246636..0b2a9a46 100644 --- a/customized/prosody.nix +++ b/customized/prosody.nix | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | { stdenv, fetchurl, libidn, openssl, makeWrapper, fetchhg | 1 | { stdenv, fetchurl, libidn, openssl, makeWrapper, fetchhg | 
| 2 | , lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop, luaevent ? null, luazlib ? null | 2 | , lua5, luasocket, luasec, luaexpat, luafilesystem, luabitop, luaevent ? null, luazlib ? null | 
| 3 | , withLibevent ? true, withZlib ? true | 3 | , withLibevent ? true, withZlib ? true | 
| 4 | , extraModules ? [], extraLibs ? [] | 4 | , communityModules ? [], extraLibs ? [], extraModules ? [] | 
| 5 | }: | 5 | }: | 
| 6 | 6 | ||
| 7 | assert withLibevent -> luaevent != null; | 7 | assert withLibevent -> luaevent != null; | 
| @@ -10,17 +10,19 @@ assert withZlib -> luazlib != null; | |||
| 10 | with stdenv.lib; | 10 | with stdenv.lib; | 
| 11 | 11 | ||
| 12 | let | 12 | let | 
| 13 | libs = [ luasocket luasec luaexpat luafilesystem luabitop ] | 13 | libs = [ luasocket luasec luaexpat luafilesystem luabitop ] | 
| 14 | ++ optional withLibevent luaevent | 14 | ++ optional withLibevent luaevent | 
| 15 | ++ optional withZlib luazlib | 15 | ++ optional withZlib luazlib | 
| 16 | ++ extraLibs; | 16 | ++ extraLibs; | 
| 17 | getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}"; | 17 | getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}"; | 
| 18 | getLuaPath = lib : getPath lib "lua"; | 18 | getLuaPath = lib : getPath lib "lua"; | 
| 19 | getLuaCPath = lib : getPath lib "so"; | 19 | getLuaCPath = lib : getPath lib "so"; | 
| 20 | copyModule = name : "cp -rv $communityModules/${name} $out/lib/prosody/modules/"; | 20 | copyModule = name : "cp -rv $communityModules/${name} $out/lib/prosody/modules/"; | 
| 21 | luaPath = concatStringsSep ";" (map getLuaPath libs); | 21 | copyExtraModule = path : "cp -rv $name/* $out/lib/prosody/modules/" | 
| 22 | luaCPath = concatStringsSep ";" (map getLuaCPath libs); | 22 | luaPath = concatStringsSep ";" (map getLuaPath libs); | 
| 23 | copyModules = concatStringsSep ";" (map copyModule (extraModules ++ ["mod_websocket"])); | 23 | luaCPath = concatStringsSep ";" (map getLuaCPath libs); | 
| 24 | copyModules = concatStringsSep ";" (map copyModule (communityModules ++ ["mod_websocket"])); | ||
| 25 | copyExtraModules = concatStringsSep ";" (map copyExtraModule extraModules); | ||
| 24 | in | 26 | in | 
| 25 | 27 | ||
| 26 | stdenv.mkDerivation rec { | 28 | stdenv.mkDerivation rec { | 
| @@ -50,6 +52,7 @@ stdenv.mkDerivation rec { | |||
| 50 | 52 | ||
| 51 | postInstall = '' | 53 | postInstall = '' | 
| 52 | ${copyModules} | 54 | ${copyModules} | 
| 55 | ${copyExtraModules} | ||
| 53 | wrapProgram $out/bin/prosody \ | 56 | wrapProgram $out/bin/prosody \ | 
| 54 | --set LUA_PATH '"${luaPath};"' \ | 57 | --set LUA_PATH '"${luaPath};"' \ | 
| 55 | --set LUA_CPATH '"${luaCPath};"' | 58 | --set LUA_CPATH '"${luaCPath};"' | 
