Skip to content

Commit

Permalink
luaPackages: Replace all rockspec packages with generated ones
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Shados committed Jun 14, 2019
1 parent 8eabbb3 commit 274715c
Show file tree
Hide file tree
Showing 9 changed files with 272 additions and 584 deletions.
25 changes: 10 additions & 15 deletions pkgs/applications/networking/browsers/luakit/default.nix
@@ -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";

Expand All @@ -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
Expand All @@ -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 = [
Expand All @@ -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"
)
'';

Expand Down
37 changes: 0 additions & 37 deletions pkgs/development/lua-modules/luasql.patch

This file was deleted.

16 changes: 16 additions & 0 deletions pkgs/development/lua-modules/luuid.patch
@@ -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);

0 comments on commit 274715c

Please sign in to comment.