luaPackages: Replace all rockspec packages with generated ones

luaPackages replaced by generated ones:
- bit32
- compat53
- cqueues
- luacyrussasl -> cyrussasl (luarocks name)
- luaexpat
- luadbi -> luadbi front-end module + separate backend modules
  luadbi-{mysql,postgresql,sqlite3}
- luafilesystem
- luaossl
- luasec
- luasocket
- luastdlib -> stdlib (luarocks name)
- lrexlib -> lrexlib-pcre (we already have lrexlib-gnu and
  lrexlib-posix, lrexlib-pcre however appears to be the variant used in
  mudlet, which is the only current dep in nixpkgs)
- luasqlite -> luasql-sqlite3 (luarocks name)
- lfs -> luafilesytem (we literally had two manually written
  luafilesystem expressions, under different names)

Changes and additions to overrides to generated luarocks packgaes,
including:
- busted: Install bash completions along with the zsh ones
- cqueues:
    - Perform minor surgery on the rockspec to allow using a single
      rockspec to build for all supported Lua versions
    - Add a patch by @vcunat to work around a build issue
- luuid: Wrote a tiny patch to allow for Lua 5.1/Luajit compatibility
- General changes:
    - Sorted the packages
    - Attempted to make the formatting consistent
    - Preferenced `.override` instead of `.overrideAttrs` wherever
      possible

Minor changes to other packages to adjust for the Lua package changes:
- luakit expression simplified
- prosody expression simplified; but users will now need to specify the
  luadbi backend module they intend to use in withExtraLibs
- knot-resolver inputs correctd
- mudlet inputs corrected (although this package was and should still be
  broken)
This commit is contained in:
Alexei Robyn 2019-06-13 21:01:10 +10:00
parent 8eabbb3d20
commit 274715cbc3
9 changed files with 289 additions and 601 deletions

View File

@ -1,17 +1,9 @@
{ stdenv, fetchFromGitHub, pkgconfig, wrapGAppsHook
, help2man, lua5, luafilesystem, luajit, sqlite
, help2man, luafilesystem, luajit, sqlite
, webkitgtk, gtk3, gst_all_1, glib-networking
}:
let
lualibs = [luafilesystem];
getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}";
getLuaPath = lib : getPath lib "lua";
getLuaCPath = lib : getPath lib "so";
luaPath = stdenv.lib.concatStringsSep ";" (map getLuaPath lualibs);
luaCPath = stdenv.lib.concatStringsSep ";" (map getLuaCPath lualibs);
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "luakit";
version = "2.1";
@ -27,7 +19,7 @@ in stdenv.mkDerivation rec {
];
buildInputs = [
webkitgtk lua5 luafilesystem luajit sqlite gtk3
webkitgtk luafilesystem luajit sqlite gtk3
gst_all_1.gstreamer gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav
@ -36,8 +28,11 @@ in stdenv.mkDerivation rec {
preBuild = ''
# build-utils/docgen/gen.lua:2: module 'lib.lousy.util' not found
# TODO: why is not this the default?
LUA_PATH=?.lua
# TODO: why is not this the default? The test runner adds
# ';./lib/?.lua;./lib/?/init.lua' to package.path, but the build-utils
# scripts don't add an equivalent
export LUA_PATH="$NIX_LUA_PATH;./?.lua;./?/init.lua"
export LUA_CPATH="$NIX_LUA_CPATH"
'';
makeFlags = [
@ -54,8 +49,8 @@ in stdenv.mkDerivation rec {
in ''
gappsWrapperArgs+=(
--prefix XDG_CONFIG_DIRS : "$out/etc/xdg"
--set LUA_PATH '${luaKitPath};${luaPath};'
--set LUA_CPATH '${luaCPath};'
--prefix LUA_PATH ';' "${luaKitPath};$NIX_LUA_PATH"
--prefix LUA_CPATH ';' "$NIX_LUA_CPATH"
)
'';

View File

@ -1,37 +0,0 @@
--- a/config 2013-02-18 19:36:44.000000000 +0400
+++ b/config 2014-10-01 08:36:37.104254404 +0400
@@ -1,12 +1,12 @@
# $Id: config,v 1.10 2008/05/30 17:21:18 tomas Exp $
# Driver (leave uncommented ONLY the line with the name of the driver)
-T= mysql
+#T= mysql
#T= oci8
#T= odbc
#T= postgres
#T= sqlite
-#T=sqlite3
+T=sqlite3
#T=firebird
# Installation directories
@@ -37,8 +37,8 @@
######## MySQL
#DRIVER_LIBS= -L/usr/local/mysql/lib -lmysqlclient -lz
#DRIVER_INCS= -I/usr/local/mysql/include
-DRIVER_LIBS= -L/usr/lib -lmysqlclient -lz
-DRIVER_INCS= -I/usr/include/mysql
+#DRIVER_LIBS= -L/usr/lib -lmysqlclient -lz
+#DRIVER_INCS= -I/usr/include/mysql
######## Oracle OCI8
#DRIVER_LIBS= -L/home/oracle/OraHome1/lib -lz -lclntsh
#DRIVER_INCS= -I/home/oracle/OraHome1/rdbms/demo -I/home/oracle/OraHome1/rdbms/public
@@ -51,7 +51,7 @@
#DRIVER_LIBS= -lsqlite
#DRIVER_INCS=
######## SQLite3
-#DRIVER_LIBS= -L/opt/local/lib -lsqlite3
+DRIVER_LIBS= -lsqlite3
#DRIVER_INCS= -I/opt/local/include
######## ODBC
#DRIVER_LIBS= -L/usr/local/lib -lodbc

View File

@ -0,0 +1,16 @@
diff -Naur 5.2/uuid/luuid.c rock/uuid/luuid.c
--- 5.2/uuid/luuid.c 2012-05-10 11:22:00.000000000 +1000
+++ rock/uuid/luuid.c 2019-06-13 15:13:10.374134079 +1000
@@ -64,7 +64,11 @@
LUALIB_API int luaopen_uuid(lua_State *L)
{
- luaL_newlib(L,R);
+ #if LUA_VERSION_NUM == 501
+ luaL_register(L,MYNAME,R);
+ #else
+ luaL_newlib(L,R);
+ #endif
lua_pushliteral(L,"version"); /** version */
lua_pushliteral(L,MYVERSION);
lua_settable(L,-3);

View File

@ -5,101 +5,72 @@ with super;
##########################################3
#### manual fixes for generated packages
##########################################3
lgi = super.lgi.overrideAttrs(oa: {
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = with pkgs; oa.buildInputs ++ [ glib gobjectIntrospection];
bit32 = super.bit32.override({
disabled = !isLua51;
# Theoretically works with luajit, but it does redefine at least one Lua
# 5.2 function that Luajit 2.1 provides, see:
# https://github.com/LuaJIT/LuaJIT/issues/325
});
busted = super.busted.override({
postConfigure = ''
substituteInPlace ''${rockspecFilename} \
--replace "'lua_cliargs = 3.0-1'," "'lua_cliargs >= 3.0-1',"
'';
postInstall = ''
install -D completions/zsh/_busted $out/share/zsh/site-functions/_busted
install -D completions/bash/busted.bash $out/share/bash-completion/completions/busted
'';
});
cqueues = super.cqueues.override(rec {
# Parse out a version number without the Lua version inserted
version = with pkgs.lib; let
version' = super.cqueues.version;
rel = splitString "." version';
date = head rel;
rev = last (splitString "-" (last rel));
in "${date}-${rev}";
nativeBuildInputs = [
pkgs.gnum4
];
externalDeps = [
{ name = "CRYPTO"; dep = pkgs.openssl; }
{ name = "OPENSSL"; dep = pkgs.openssl; }
];
patches = [
# https://github.com/wahern/cqueues/issues/216 &
# https://github.com/wahern/cqueues/issues/217
(pkgs.fetchpatch {
name = "lgi-find-cairo-through-typelib.patch";
url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
name = "find-version-fix.patch";
url = "https://github.com/wahern/cqueues/pull/217.patch";
sha256 = "0068ql0jlxmjkvhzydyy52sjd0k4vad6b8w4y5szpbv4vb2lzcsc";
})
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
# Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
# version, which doesn't work well for us, so modify it
postConfigure = let inherit (super.cqueues) pname; in ''
# 'all' target auto-detects correct Lua version, which is fine for us as
# we only have the right one available :)
sed -Ei ''${rockspecFilename} \
-e 's|lua == 5.[[:digit:]]|lua >= 5.1, <= 5.3|' \
-e 's|build_target = "[^"]+"|build_target = "all"|' \
-e 's|version = "[^"]+"|version = "${version}"|'
specDir=$(dirname ''${rockspecFilename})
cp ''${rockspecFilename} "$specDir/${pname}-${version}.rockspec"
rockspecFilename="$specDir/${pname}-${version}.rockspec"
'';
});
cyrussasl = super.cyrussasl.override({
externalDeps = [
{ name = "LIBSASL"; dep = pkgs.cyrus_sasl; }
];
});
ltermbox = super.ltermbox.override( {
disabled = !isLua51 || isLuaJIT;
});
lua-cmsgpack = super.lua-cmsgpack.override({
# TODO this should work with luajit once we fix luajit headers ?
disabled = (!isLua51) || isLuaJIT;
});
lrexlib-posix = super.lrexlib-posix.override({
buildInputs = [ pkgs.glibc.dev ];
});
lrexlib-gnu = super.lrexlib-gnu.override({
buildInputs = [ pkgs.gnulib ];
});
lua-zlib = super.lua-zlib.override({
buildInputs = [ pkgs.zlib.dev ];
disabled=luaOlder "5.1" || luaAtLeast "5.4";
});
luaevent = super.luaevent.override({
buildInputs = with pkgs; [ libevent.dev libevent ];
propagatedBuildInputs = [ luasocket ];
extraConfig = ''
variables={
EVENT_INCDIR="${pkgs.libevent.dev}/include";
EVENT_LIBDIR="${pkgs.libevent}/lib";
}
'';
disabled= luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT;
});
lua-iconv = super.lua-iconv.override({
buildInputs = [ pkgs.libiconv ];
});
luazip = super.luazip.override({
buildInputs = [ pkgs.zziplib ];
});
luv = super.luv.overrideAttrs(oa: {
# Use system libuv instead of building local and statically linking
# This is a hacky way to specify -DWITH_SHARED_LIBUV=ON which
# should be possible but I'm unable to make work.
# While at it, remove bundled libuv source entirely to be sure.
# We may wish to drop bundled lua submodules too...
preBuild = ''
sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt
rm -rf deps/libuv
'';
propagatedBuildInputs = oa.propagatedBuildInputs ++ [ pkgs.libuv ];
});
busted = super.busted.overrideAttrs(oa: {
postInstall = ''
install -D completions/zsh/_busted $out/share/zsh/site-functions/_busted
'';
});
luuid = super.luuid.override(oa: {
buildInputs = [ pkgs.libuuid ];
extraConfig = ''
variables = {
LIBUUID_INCDIR="${pkgs.lib.getDev pkgs.libuuid}/include";
LIBUUID_LIBDIR="${pkgs.lib.getLib pkgs.libuuid}/lib";
}
'';
meta = oa.meta // {
platforms = pkgs.lib.platforms.linux;
};
});
rapidjson = super.rapidjson.overrideAttrs(oa: {
preBuild = ''
sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt
sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt
'';
});
binaryheap = super.binaryheap.overrideAttrs(oa: {
meta = oa.meta // {
maintainers = with pkgs.lib.maintainers; oa.meta.maintainers ++ [ vcunat ];
};
});
http = super.http.overrideAttrs(oa: {
patches = oa.patches or [] ++ [
http = super.http.override({
patches = [
(pkgs.fetchpatch {
name = "invalid-state-progression.patch";
url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff";
@ -110,8 +81,184 @@ with super;
nativeBuildInputs = [ pandoc ];
makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ];
*/
meta = oa.meta // {
maintainers = with pkgs.lib.maintainers; oa.meta.maintainers ++ [ vcunat ];
});
lgi = super.lgi.override({
nativeBuildInputs = [
pkgs.pkgconfig
];
buildInputs = [
pkgs.glib
pkgs.gobjectIntrospection
];
patches = [
(pkgs.fetchpatch {
name = "lgi-find-cairo-through-typelib.patch";
url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
})
];
});
lrexlib-gnu = super.lrexlib-gnu.override({
buildInputs = [
pkgs.gnulib
];
});
lrexlib-pcre = super.lrexlib-pcre.override({
externalDeps = [
{ name = "PCRE"; dep = pkgs.pcre; }
];
});
lrexlib-posix = super.lrexlib-posix.override({
buildInputs = [
pkgs.glibc.dev
];
});
ltermbox = super.ltermbox.override( {
disabled = !isLua51 || isLuaJIT;
});
lua-iconv = super.lua-iconv.override({
buildInputs = [
pkgs.libiconv
];
});
lua-zlib = super.lua-zlib.override({
buildInputs = [
pkgs.zlib.dev
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
});
luadbi-mysql = super.luadbi-mysql.override({
extraVariables = ''
-- Can't just be /include, unfortunately
MYSQL_INCDIR='${pkgs.mysql.connector-c}/include/mysql';
'';
buildInputs = [
pkgs.mysql.client
pkgs.mysql.connector-c
];
});
luadbi-postgresql = super.luadbi-postgresql.override({
buildInputs = [
pkgs.postgresql
];
});
luadbi-sqlite3 = super.luadbi-sqlite3.override({
externalDeps = [
{ name = "SQLITE"; dep = pkgs.sqlite; }
];
});
luaevent = super.luaevent.override({
propagatedBuildInputs = [
luasocket
];
externalDeps = [
{ name = "EVENT"; dep = pkgs.libevent; }
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
});
luaexpat = super.luaexpat.override({
externalDeps = [
{ name = "EXPAT"; dep = pkgs.expat; }
];
});
# TODO Somehow automatically amend buildInputs for things that need luaffi
# but are in luajitPackages?
luaffi = super.luaffi.override({
# The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3
src = pkgs.fetchFromGitHub {
owner = "facebook"; repo = "luaffifb";
rev = "532c757e51c86f546a85730b71c9fef15ffa633d";
sha256 = "1nwx6sh56zfq99rcs7sph0296jf6a9z72mxknn0ysw9fd7m1r8ig";
};
knownRockspec = with super.luaffi; "${pname}-${version}.rockspec";
disabled = luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT;
});
luaossl = super.luaossl.override({
externalDeps = [
{ name = "CRYPTO"; dep = pkgs.openssl; }
{ name = "OPENSSL"; dep = pkgs.openssl; }
];
});
luasec = super.luasec.override({
externalDeps = [
{ name = "OPENSSL"; dep = pkgs.openssl; }
];
});
luasql-sqlite3 = super.luasql-sqlite3.override({
externalDeps = [
{ name = "SQLITE"; dep = pkgs.sqlite; }
];
});
luasystem = super.luasystem.override({
buildInputs = [
pkgs.glibc
];
});
luazip = super.luazip.override({
buildInputs = [
pkgs.zziplib
];
});
luuid = super.luuid.override(old: {
externalDeps = [
{ name = "LIBUUID"; dep = pkgs.libuuid; }
];
meta = old.meta // {
platforms = pkgs.lib.platforms.linux;
};
# Trivial patch to make it work in both 5.1 and 5.2. Basically just the
# tiny diff between the two upstream versions placed behind an #if.
# Upstreams:
# 5.1: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/luuid.tar.gz
# 5.2: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/luuid.tar.gz
patchFlags = "-p2";
patches = [
./luuid.patch
];
postConfigure = let inherit (super.luuid) version pname; in ''
sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|'
'';
disabled = luaOlder "5.1" || (luaAtLeast "5.4");
});
luv = super.luv.override({
# Use system libuv instead of building local and statically linking
# This is a hacky way to specify -DWITH_SHARED_LIBUV=ON which
# is not possible with luarocks and the current luv rockspec
# While at it, remove bundled libuv source entirely to be sure.
# We may wish to drop bundled lua submodules too...
preBuild = ''
sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt
rm -rf deps/libuv
'';
propagatedBuildInputs = [
pkgs.libuv
];
});
rapidjson = super.rapidjson.override({
preBuild = ''
sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt
sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt
'';
});
}

View File

@ -1,5 +1,5 @@
{ fetchurl, unzip, stdenv, makeWrapper, qtbase, yajl, libzip, hunspell
, boost, lua5_1, luafilesystem, luazip, lrexlib, luasqlite3, qmake }:
, boost, lua5_1, luafilesystem, luazip, lrexlib-pcre, luasql-sqlite3, qmake }:
stdenv.mkDerivation rec {
name = "mudlet-${version}";
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ makeWrapper qmake ];
buildInputs = [
unzip qtbase lua5_1 hunspell libzip yajl boost
luafilesystem luazip lrexlib luasqlite3
luafilesystem luazip lrexlib-pcre luasql-sqlite3
];
preConfigure = "cd src";
@ -21,8 +21,8 @@ stdenv.mkDerivation rec {
installPhase = let
luaZipPath = "${luazip}/lib/lua/5.1/?.so";
luaFileSystemPath = "${luafilesystem}/lib/lua/5.1/?.so";
lrexlibPath = "${lrexlib}/lib/lua/5.1/?.so";
luasqlitePath = "${luasqlite3}/lib/lua/5.1/?.so";
lrexlibPath = "${lrexlib-pcre}/lib/lua/5.1/?.so";
luasqlitePath = "${luasql-sqlite3}/lib/lua/5.1/?.so";
in ''
mkdir -pv $out/bin
cp mudlet $out

View File

@ -80,7 +80,7 @@ wrapped-full = runCommand unwrapped.name
nativeBuildInputs = [ makeWrapper ];
buildInputs = with luajitPackages; [
luasec luasocket # trust anchor bootstrap, prefill module
lfs # prefill module
luafilesystem # prefill module
http # for http module; brings lots of deps; some are useful elsewhere
];
preferLocalBuild = true;

View File

@ -12,17 +12,6 @@ assert withDBI -> luadbi != null;
with stdenv.lib;
let
libs = [ luasocket luasec luaexpat luafilesystem luabitop ]
++ optional withLibevent luaevent
++ optional withDBI luadbi
++ withExtraLibs;
getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}";
getLuaPath = lib : getPath lib "lua";
getLuaCPath = lib : getPath lib "so";
luaPath = concatStringsSep ";" (map getLuaPath libs);
luaCPath = concatStringsSep ";" (map getLuaCPath libs);
in
stdenv.mkDerivation rec {
version = "0.11.2"; # also update communityModules
@ -42,8 +31,17 @@ stdenv.mkDerivation rec {
sha256 = "0bzn92j48krb2zhp9gn5bbn5sg0qv15j5lpxfszwqdln3lpmrvzg";
};
buildInputs = [ lua5 makeWrapper libidn openssl ]
++ optional withDBI luadbi;
buildInputs = [
lua5 makeWrapper libidn openssl
]
# Lua libraries
++ [
luasocket luasec luaexpat luafilesystem luabitop
]
++ optional withLibevent luaevent
++ optional withDBI luadbi
++ withExtraLibs;
configureFlags = [
"--ostype=linux"
@ -56,12 +54,12 @@ stdenv.mkDerivation rec {
cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
'') (withCommunityModules ++ withOnlyInstalledCommunityModules)}
wrapProgram $out/bin/prosody \
--set LUA_PATH '${luaPath};' \
--set LUA_CPATH '${luaCPath};'
--prefix LUA_PATH ';' "$NIX_LUA_PATH" \
--prefix LUA_CPATH ';' "$NIX_LUA_CPATH"
wrapProgram $out/bin/prosodyctl \
--add-flags '--config "/etc/prosody/prosody.cfg.lua"' \
--set LUA_PATH '${luaPath};' \
--set LUA_CPATH '${luaCPath};'
--prefix LUA_PATH ';' "$NIX_LUA_PATH" \
--prefix LUA_CPATH ';' "$NIX_LUA_CPATH"
'';
passthru.communityModules = withCommunityModules;

View File

@ -18890,8 +18890,7 @@ in
};
luakit = callPackage ../applications/networking/browsers/luakit {
inherit (lua51Packages) luafilesystem;
lua5 = lua5_1;
inherit (luajitPackages) luafilesystem;
};
looking-glass-client = callPackage ../applications/virtualization/looking-glass-client { };
@ -21649,7 +21648,7 @@ in
mrrescue = callPackage ../games/mrrescue { };
mudlet = libsForQt5.callPackage ../games/mudlet {
inherit (lua51Packages) luafilesystem lrexlib luazip luasqlite3;
inherit (lua51Packages) luafilesystem lrexlib-pcre luazip luasql-sqlite3;
};
n2048 = callPackage ../games/n2048 {};

View File

@ -57,7 +57,7 @@ let
buildLuaApplication = args: buildLuarocksPackage ({namePrefix="";} // args );
buildLuarocksPackage = with pkgs.lib; makeOverridable( callPackage ../development/interpreters/lua-5/build-lua-package.nix {
buildLuarocksPackage = with pkgs.lib; makeOverridable(callPackage ../development/interpreters/lua-5/build-lua-package.nix {
inherit toLuaModule;
inherit lua;
});
@ -99,327 +99,6 @@ with self; {
luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { };
bit32 = buildLuaPackage rec {
version = "5.3.0";
name = "bit32-${version}";
src = fetchFromGitHub {
owner = "keplerproject";
repo = "lua-compat-5.2";
rev = "bitlib-${version}";
sha256 = "1ipqlbvb5w394qwhm2f3w6pdrgy8v4q8sps5hh3pqz14dcqwakhj";
};
buildPhase = ''
cc ${if stdenv.isDarwin then "-bundle -undefined dynamic_lookup -all_load" else "-shared"} -Ic-api lbitlib.c -o bit32.so
'';
installPhase = ''
mkdir -p $out/lib/lua/${lua.luaversion}
install -p bit32.so $out/lib/lua/${lua.luaversion}
'';
meta = with stdenv.lib; {
description = "Lua 5.2 bit manipulation library";
homepage = "http://www.lua.org/manual/5.2/manual.html#6.7";
license = licenses.mit;
maintainers = with maintainers; [ lblasc ];
platforms = platforms.unix;
};
};
compat53 = buildLuaPackage rec {
version = "0.7";
name = "compat53-${version}";
src = fetchFromGitHub {
owner = "keplerproject";
repo = "lua-compat-5.3";
rev = "v${version}";
sha256 = "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz";
};
nativeBuildInputs = [ pkgconfig ];
postConfigure = ''
CFLAGS+=" -shared $(pkg-config --libs ${if isLuaJIT then "luajit" else "lua"})"
'';
buildPhase = ''
cc lstrlib.c $CFLAGS -o string.so
cc ltablib.c $CFLAGS -o table.so
cc lutf8lib.c $CFLAGS -o utf8.so
'';
# The hook in ../development/lua-modules/generic/default.nix
# is strict about share vs. lib for _PATH and _CPATH.
installPhase = ''
install -Dt "$out/share/lua/${lua.luaversion}/compat53" compat53/*.lua
install -Dt "$out/lib/lua/${lua.luaversion}/compat53" *.so
'';
meta = with stdenv.lib; {
description = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1";
homepage = "https://github.com/keplerproject/lua-compat-5.3";
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
platforms = platforms.all;
};
};
cqueues = buildLuaPackage rec {
name = "cqueues-${version}";
version = "20171014";
src = fetchurl {
url = "https://www.25thandclement.com/~william/projects/releases/${name}.tgz";
sha256 = "1dabhpn6r0hlln8vx9hxm34pfcm46qzgpb2apmziwg5z51fi4ksb";
};
preConfigure = ''export prefix=$out'';
# https://github.com/wahern/cqueues/issues/216
NIX_CFLAGS_COMPILE = [ "-DCQUEUES_VERSION=${version}" ];
nativeBuildInputs = [ gnum4 ];
buildInputs = [ openssl ];
meta = with stdenv.lib; {
description = "A type of event loop for Lua";
homepage = "https://www.25thandclement.com/~william/projects/cqueues.html";
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
platforms = platforms.unix;
};
};
luacyrussasl = buildLuaPackage rec {
version = "1.1.0";
name = "lua-cyrussasl-${version}";
src = fetchFromGitHub {
owner = "JorjBauer";
repo = "lua-cyrussasl";
rev = "v${version}";
sha256 = "14kzm3vk96k2i1m9f5zvpvq4pnzaf7s91h5g4h4x2bq1mynzw2s1";
};
preBuild = ''
makeFlagsArray=(
CFLAGS="-O2 -fPIC"
LDFLAGS="-O -shared -fpic -lsasl2"
LUAPATH="$out/share/lua/${lua.luaversion}"
CPATH="$out/lib/lua/${lua.luaversion}"
);
mkdir -p $out/{share,lib}/lua/${lua.luaversion}
'';
buildInputs = [ cyrus_sasl ];
meta = with stdenv.lib; {
homepage = "https://github.com/JorjBauer/lua-cyrussasl";
description = "Cyrus SASL library for Lua 5.1+";
license = licenses.bsd3;
};
};
luaexpat = buildLuaPackage rec {
version = "1.3.0";
name = "expat-${version}";
src = fetchurl {
url = "https://matthewwild.co.uk/projects/luaexpat/luaexpat-${version}.tar.gz";
sha256 = "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h";
};
buildInputs = [ expat ];
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace Makefile \
--replace '-shared' '-bundle -undefined dynamic_lookup -all_load'
'';
preBuild = ''
makeFlagsArray=(
LUA_LDIR="$out/share/lua/${lua.luaversion}"
LUA_INC="-I${lua}/include" LUA_CDIR="$out/lib/lua/${lua.luaversion}"
EXPAT_INC="-I${expat.dev}/include");
'';
disabled = isLua53 || isLuaJIT;
meta = with stdenv.lib; {
description = "SAX XML parser based on the Expat library";
homepage = "http://matthewwild.co.uk/projects/luaexpat";
license = licenses.mit;
maintainers = with maintainers; [ flosse ];
platforms = platforms.unix;
};
};
luadbi = buildLuaPackage rec {
name = "luadbi-${version}";
version = "0.7.2";
src = fetchFromGitHub {
owner = "mwild1";
repo = "luadbi";
rev = "v${version}";
sha256 = "167ivwmczhp98bxzpz3wdxcfj6vi0a10gpi7rdfjs2rbfwkzqvjh";
};
MYSQL_INC = [ "-I${mysql.connector-c}/include/mysql" ];
MYSQL_LDFLAGS= [
"-lmysqlclient"
"-L${mysql.connector-c}/lib/mysql"
];
nativeBuildInputs = [ mysql.client ];
buildInputs = [ mysql.connector-c postgresql sqlite ];
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace Makefile \
--replace '-shared' '-bundle -undefined dynamic_lookup -all_load'
'';
installFlags = [
"LUA_CDIR=$(out)/lib/lua/${lua.luaversion}"
"LUA_LDIR=$(out)/share/lua/${lua.luaversion}"
];
installTargets = [
"install_lua" "install_mysql" "install_psql" "install_sqlite3"
];
meta = with stdenv.lib; {
homepage = https://github.com/mwild1/luadbi;
license = licenses.mit;
platforms = stdenv.lib.platforms.unix;
};
};
luafilesystem = buildLuaPackage rec {
version = "1.7.0";
name = "filesystem-${version}";
src = fetchFromGitHub {
owner = "keplerproject";
repo = "luafilesystem";
rev = "v${stdenv.lib.replaceChars ["."] ["_"] version}";
sha256 = "0fibrasshlgpa71m9wkpjxwmylnxpcf06rpqbaa0qwvqh94nhwby";
};
preConfigure = ''
substituteInPlace config --replace "CC= gcc" "";
''
+ stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace config \
--replace 'LIB_OPTION= -shared' '###' \
--replace '#LIB_OPTION= -bundle' 'LIB_OPTION= -bundle'
substituteInPlace Makefile --replace '10.3' '10.5'
'';
meta = with stdenv.lib; {
description = "Lua library complementing filesystem-related functions";
homepage = "https://github.com/keplerproject/luafilesystem";
license = licenses.mit;
maintainers = with maintainers; [ flosse ];
platforms = platforms.unix;
};
};
luaossl = buildLuaPackage rec {
name = "luaossl-${version}";
version = "20181207";
src = fetchurl {
url = "https://github.com/wahern/luaossl/releases/download/rel-${version}/luaossl-rel-${version}.zip";
sha256 = "194r6db80ksh4zh8d2k35q6vci9zbrfvkanjl280y6ij2xyhkvj7";
};
preConfigure = ''export prefix=$out'';
nativeBuildInputs = [ unzip ];
buildInputs = [ openssl ];
meta = with stdenv.lib; {
description = "Comprehensive binding to OpenSSL for Lua 5.1+";
homepage = "https://www.25thandclement.com/~william/projects/luaossl.html";
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
platforms = platforms.unix;
};
};
luasec = buildLuaPackage rec {
name = "sec-0.8";
src = fetchFromGitHub {
owner = "brunoos";
repo = "luasec";
rev = "lua${name}";
sha256 = "1cgb7ihnrrfr59a2da4d3chr7lqpid98xpglmzhv3hrpg4x5sksz";
};
propagatedBuildInputs = [ luasocket ];
buildInputs = [ openssl ];
preBuild = ''
makeFlagsArray=(
${platformString}
LUAPATH="$out/share/lua/${lua.luaversion}"
LUACPATH="$out/lib/lua/${lua.luaversion}"
INC_PATH="-I${lua}/include"
LIB_PATH="-L$out/lib");
'';
meta = with stdenv.lib; {
description = "Lua binding for OpenSSL library to provide TLS/SSL communication";
homepage = "https://github.com/brunoos/luasec";
license = licenses.mit;
maintainers = with maintainers; [ flosse ];
platforms = platforms.unix;
};
};
luasocket = buildLuaPackage rec {
name = "socket-${version}";
version = "3.0-rc1";
src = fetchFromGitHub {
owner = "diegonehab";
repo = "luasocket";
rev = "v${version}";
sha256 = "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk";
};
patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace src/makefile \
--replace 10.3 10.5
'';
preBuild = ''
makeFlagsArray=(
LUAV=${lua.luaversion}
PLAT=${platformString}
CC=''${CC}
LD=''${CC}
prefix=$out
);
'';
doCheck = false; # fails to find itself
installTargets = [ "install" "install-unix" ];
meta = with stdenv.lib; {
description = "Network support for Lua";
homepage = "http://w3.impa.br/~diego/software/luasocket/";
license = licenses.mit;
maintainers = with maintainers; [ ];
platforms = with platforms; darwin ++ linux ++ freebsd ++ illumos;
};
};
luxio = buildLuaPackage rec {
name = "luxio-${version}";
version = "13";
@ -453,115 +132,6 @@ with self; {
};
};
luastdlib = buildLuaPackage rec {
name = "stdlib-${version}";
version = "41.2.1";
src = fetchFromGitHub {
owner = "lua-stdlib";
repo = "lua-stdlib";
rev = "release-v${version}";
sha256 = "03wd1qvkrj50fjszb2apzdkc8d5bpfbbi9pajl0vbrlzzmmi3jlq";
};
nativeBuildInputs = [ autoreconfHook unzip ];
meta = with stdenv.lib; {
description = "General Lua libraries";
homepage = "https://github.com/lua-stdlib/lua-stdlib";
license = licenses.mit;
maintainers = with maintainers; [ vyp ];
platforms = platforms.linux;
};
};
lrexlib = buildLuaPackage rec {
name = "lrexlib-${version}";
version = "2.8.0";
src = fetchFromGitHub {
owner = "rrthomas";
repo = "lrexlib";
rev = "rel-2-8-0";
sha256 = "1c62ny41b1ih6iddw5qn81gr6dqwfffzdp7q6m8x09zzcdz78zhr";
};
buildInputs = [ luastdlib pcre luarocks oniguruma gnulib tre glibc ];
buildPhase = let
luaVariable = ''LUA_PATH="${luastdlib}/share/lua/${lua.luaversion}/?/init.lua;${luastdlib}/share/lua/${lua.luaversion}/?.lua"'';
pcreVariable = "PCRE_DIR=${pcre.out} PCRE_INCDIR=${pcre.dev}/include";
onigVariable = "ONIG_DIR=${oniguruma}";
gnuVariable = "GNU_INCDIR=${gnulib}/lib";
treVariable = "TRE_DIR=${tre}";
posixVariable = "POSIX_DIR=${glibc.dev}";
in ''
sed -e 's@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i;@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i ${pcreVariable} ${onigVariable} ${gnuVariable} ${treVariable} ${posixVariable};@' -i Makefile
${luaVariable} make
'';
installPhase = ''
mkdir -pv $out;
cp -r luarocks/lib $out;
'';
meta = with stdenv.lib; {
description = "Lua bindings of various regex library APIs";
homepage = "https://github.com/rrthomas/lrexlib";
license = licenses.mit;
maintainers = with maintainers; [ vyp ];
platforms = platforms.linux;
};
};
luasqlite3 = buildLuaPackage rec {
name = "sqlite3-${version}";
version = "2.3.0";
src = fetchFromGitHub {
owner = "LuaDist";
repo = "luasql-sqlite3";
rev = version;
sha256 = "05k8zs8nsdmlwja3hdhckwknf7ww5cvbp3sxhk2xd1i3ij6aa10b";
};
disabled = isLua53;
buildInputs = [ sqlite ];
patches = [ ../development/lua-modules/luasql.patch ];
meta = with stdenv.lib; {
description = "Database connectivity for Lua";
homepage = "https://github.com/LuaDist/luasql-sqlite3";
license = licenses.mit;
maintainers = with maintainers; [ vyp ];
platforms = platforms.linux;
};
};
lfs = buildLuaPackage rec {
name = "lfs-${version}";
version = "1.7.0.2";
src = fetchFromGitHub {
owner = "keplerproject";
repo = "luafilesystem";
rev = "v" + stdenv.lib.replaceStrings ["."] ["_"] version;
sha256 = "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi";
};
meta = with stdenv.lib; {
description = "Portable library for filesystem operations";
homepage = https://keplerproject.github.com/luafilesystem;
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
platforms = platforms.all;
};
};
vicious = toLuaModule(stdenv.mkDerivation rec {
name = "vicious-${version}";
version = "2.3.1";