summaryrefslogtreecommitdiff
path: root/customized/prosody.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-09-30 16:30:31 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-09-30 16:30:31 +0200
commit98a00c76219180f5b39463a1132e5ae69fbb77a7 (patch)
tree3ff9433d9669f971ef245a1df14141651d4da7ad /customized/prosody.nix
parentecfb534f4d291e84310dadb9e591de564b00e593 (diff)
downloadnixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.tar
nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.tar.gz
nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.tar.bz2
nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.tar.xz
nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.zip
provisions for completely custom modules
Diffstat (limited to 'customized/prosody.nix')
-rw-r--r--customized/prosody.nix27
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
7assert withLibevent -> luaevent != null; 7assert withLibevent -> luaevent != null;
@@ -10,17 +10,19 @@ assert withZlib -> luazlib != null;
10with stdenv.lib; 10with stdenv.lib;
11 11
12let 12let
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);
24in 26in
25 27
26stdenv.mkDerivation rec { 28stdenv.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};"'