lua*Packages: Consolidate separate setup hooks together

- Lua packages now consistently use LUA_PATH/LUA_CPATH rather than a mix
  of those and NIX_LUA_PATH/NIX_LUA_CPATH
- Lua libraries are now consistently only added to the search path
variables if:
    1) The library actually has a corresponding directory to search
    2) The library is not already present in the search path
  This should help prevent the search paths from growing overly large
- Fixed bugs in some path helpers
- Changed the affected shell script indentation to 2 spaces; nixpkgs
  shell scripts are inconsistently split between 2 and 4 space
  indentation, but 2 matches better with the Nix expressions, so IMO it
  makes more sense
This commit is contained in:
Alexei Robyn
2019-09-01 17:42:20 +02:00
committed by Frederik Rietdijk
parent 59d85b9910
commit c62337d9c7
5 changed files with 103 additions and 132 deletions
+7 -6
View File
@@ -64,17 +64,18 @@ in
with self; {
getLuaPathList = majorVersion: [
"lib/lua/${majorVersion}/?.lua" "share/lua/${majorVersion}/?.lua"
"share/lua/${majorVersion}/?/init.lua" "lib/lua/${majorVersion}/?/init.lua"
"share/lua/${majorVersion}/?.lua"
"share/lua/${majorVersion}/?/init.lua"
];
getLuaCPathList = majorVersion: [
"lib/lua/${majorVersion}/?.so" "share/lua/${majorVersion}/?.so" "share/lua/${majorVersion}/?/init.so"
"lib/lua/${majorVersion}/?.so"
];
# helper functions for dealing with LUA_PATH and LUA_CPATH
getPath = lib : type : "${lib}/lib/lua/${lua.luaversion}/?.${type};${lib}/share/lua/${lua.luaversion}/?.${type}";
getLuaPath = lib : getPath lib "lua";
getLuaCPath = lib : getPath lib "so";
getPath = drv: pathListForVersion:
lib.concatMapStringsSep ";" (path: "${drv}/${path}") (pathListForVersion lua.luaversion);
getLuaPath = drv: getPath drv getLuaPathList;
getLuaCPath = drv: getPath drv getLuaCPathList;
#define build lua package function
buildLuaPackage = callPackage ../development/lua-modules/generic {