diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-09-30 16:30:31 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-09-30 16:30:31 +0200 |
commit | 98a00c76219180f5b39463a1132e5ae69fbb77a7 (patch) | |
tree | 3ff9433d9669f971ef245a1df14141651d4da7ad | |
parent | ecfb534f4d291e84310dadb9e591de564b00e593 (diff) | |
download | nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.tar nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.tar.gz nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.tar.bz2 nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.tar.xz nixos-98a00c76219180f5b39463a1132e5ae69fbb77a7.zip |
provisions for completely custom modules
-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};"' |