1 # do not add pkgs, it messes up splicing
18 , gobject-introspection
55 ##########################################3
56 #### manual fixes for generated packages
57 ##########################################3
58 bit32 = prev.bit32.overrideAttrs (oa: {
59 # Small patch in order to no longer redefine a Lua 5.2 function that Luajit
60 # 2.1 also provides, see https://github.com/LuaJIT/LuaJIT/issues/325 for
65 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
68 busted = prev.busted.overrideAttrs (oa: {
69 nativeBuildInputs = oa.nativeBuildInputs ++ [
73 substituteInPlace ''${rockspecFilename} \
74 --replace "'lua_cliargs = 3.0-1'," "'lua_cliargs >= 3.0-1',"
77 installShellCompletion --cmd busted \
78 --zsh completions/zsh/_busted \
79 --bash completions/bash/busted.bash
83 cqueues = prev.cqueues.overrideAttrs (oa: rec {
84 # Parse out a version number without the Lua version inserted
85 version = with lib; let
86 version' = prev.cqueues.version;
87 rel = splitVersion version';
89 rev = last (splitString "-" (last rel));
93 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
95 nativeBuildInputs = oa.nativeBuildInputs ++ [
100 { name = "CRYPTO"; dep = openssl; }
101 { name = "OPENSSL"; dep = openssl; }
104 # Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
105 # version, which doesn't work well for us, so modify it
106 postConfigure = let inherit (prev.cqueues) pname; in
108 # 'all' target auto-detects correct Lua version, which is fine for us as
109 # we only have the right one available :)
110 sed -Ei ''${rockspecFilename} \
111 -e 's|lua == 5.[[:digit:]]|lua >= 5.1, <= 5.3|' \
112 -e 's|build_target = "[^"]+"|build_target = "all"|' \
113 -e 's|version = "[^"]+"|version = "${version}"|'
114 specDir=$(dirname ''${rockspecFilename})
115 cp ''${rockspecFilename} "$specDir/${pname}-${version}.rockspec"
116 rockspecFilename="$specDir/${pname}-${version}.rockspec"
120 fennel = prev.fennel.overrideAttrs(oa: {
121 nativeBuildInputs = oa.nativeBuildInputs ++ [
125 installManPage fennel.1
129 http = prev.http.overrideAttrs (oa: {
132 name = "invalid-state-progression.patch";
133 url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff";
134 sha256 = "1vmx039n3nqfx50faqhs3wgiw28ws416rhw6vh6srmh9i826dac7";
137 /* TODO: separate docs derivation? (pandoc is heavy)
138 nativeBuildInputs = [ pandoc ];
139 makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ];
143 ldbus = prev.ldbus.overrideAttrs (oa: {
145 DBUS_DIR = "${dbus.lib}";
146 DBUS_ARCH_INCDIR = "${dbus.lib}/lib/dbus-1.0/include";
147 DBUS_INCDIR = "${dbus.dev}/include/dbus-1.0";
154 ljsyscall = prev.ljsyscall.overrideAttrs (oa: rec {
155 version = "unstable-20180515";
156 # package hasn't seen any release for a long time
157 src = fetchFromGitHub {
158 owner = "justincormack";
160 rev = "e587f8c55aad3955dddab3a4fa6c1968037b5c6e";
161 sha256 = "06v52agqyziwnbp2my3r7liv245ddmb217zmyqakh0ldjdsr8lz4";
163 knownRockspec = "rockspec/ljsyscall-scm-1.rockspec";
164 # actually library works fine with lua 5.2
166 sed -i 's/lua == 5.1/lua >= 5.1, < 5.3/' ${knownRockspec}
168 meta.broken = luaOlder "5.1" || luaAtLeast "5.3";
170 propagatedBuildInputs = with lib; oa.propagatedBuildInputs ++ optional (!isLuaJIT) luaffi;
173 lgi = prev.lgi.overrideAttrs (oa: {
174 nativeBuildInputs = oa.nativeBuildInputs ++ [
179 gobject-introspection
183 name = "lgi-find-cairo-through-typelib.patch";
184 url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
185 sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
189 # https://github.com/lgi-devs/lgi/pull/300
191 substituteInPlace lgi/Makefile tests/Makefile \
192 --replace 'PKG_CONFIG =' 'PKG_CONFIG ?='
195 # there is only a rockspec.in in the repo, the actual rockspec must be generated
201 lmathx = prev.luaLib.overrideLuarocks prev.lmathx (drv:
202 if luaAtLeast "5.1" && luaOlder "5.2" then {
203 version = "20120430.51-1";
204 knownRockspec = (fetchurl {
205 url = "https://luarocks.org/lmathx-20120430.51-1.rockspec";
206 sha256 = "148vbv2g3z5si2db7rqg5bdily7m4sjyh9w6r3jnx3csvfaxyhp0";
209 url = "https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/lmathx.tar.gz";
210 sha256 = "0sa553d0zlxhvpsmr4r7d841f16yq4wr3fg7i07ibxkz6yzxax51";
213 if luaAtLeast "5.2" && luaOlder "5.3" then {
214 version = "20120430.52-1";
215 knownRockspec = (fetchurl {
216 url = "https://luarocks.org/lmathx-20120430.52-1.rockspec";
217 sha256 = "14rd625sipakm72wg6xqsbbglaxyjba9nsajsfyvhg0sz8qjgdya";
220 url = "http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/lmathx.tar.gz";
221 sha256 = "19dwa4z266l2njgi6fbq9rak4rmx2fsx1s0p9sl166ar3mnrdwz5";
225 disabled = luaOlder "5.1" || luaAtLeast "5.5";
226 # works fine with 5.4 as well
228 substituteInPlace ''${rockspecFilename} \
229 --replace 'lua ~> 5.3' 'lua >= 5.3, < 5.5'
233 lmpfrlib = prev.lmpfrlib.overrideAttrs (oa: {
235 { name = "GMP"; dep = gmp; }
236 { name = "MPFR"; dep = mpfr; }
239 cp $src $(stripHash $src)
243 lrexlib-gnu = prev.lrexlib-gnu.overrideAttrs (oa: {
244 buildInputs = oa.buildInputs ++ [
249 lrexlib-pcre = prev.lrexlib-pcre.overrideAttrs (oa: {
251 { name = "PCRE"; dep = pcre; }
255 lrexlib-posix = prev.lrexlib-posix.overrideAttrs (oa: {
256 buildInputs = oa.buildInputs ++ [
261 lua-curl = prev.lua-curl.overrideAttrs (oa: {
262 buildInputs = oa.buildInputs ++ [
267 lua-iconv = prev.lua-iconv.overrideAttrs (oa: {
268 buildInputs = oa.buildInputs ++ [
273 lua-lsp = prev.lua-lsp.overrideAttrs (oa: {
274 # until Alloyed/lua-lsp#28
276 substituteInPlace ''${rockspecFilename} \
277 --replace '"dkjson ~> 2.5",' '"dkjson >= 2.5",'
281 lua-zlib = prev.lua-zlib.overrideAttrs (oa: {
282 buildInputs = oa.buildInputs ++ [
285 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
288 luadbi-mysql = prev.luadbi-mysql.overrideAttrs (oa: {
290 # Can't just be /include and /lib, unfortunately needs the trailing 'mysql'
291 MYSQL_INCDIR = "${libmysqlclient.dev}/include/mysql";
292 MYSQL_LIBDIR = "${libmysqlclient}/lib/mysql";
294 buildInputs = oa.buildInputs ++ [
300 luadbi-postgresql = prev.luadbi-postgresql.overrideAttrs (oa: {
301 buildInputs = oa.buildInputs ++ [
306 luadbi-sqlite3 = prev.luadbi-sqlite3.overrideAttrs (oa: {
308 { name = "SQLITE"; dep = sqlite; }
312 luaevent = prev.luaevent.overrideAttrs (oa: {
313 propagatedBuildInputs = oa.propagatedBuildInputs ++ [
317 { name = "EVENT"; dep = libevent; }
319 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
322 luaexpat = prev.luaexpat.overrideAttrs (_: {
324 { name = "EXPAT"; dep = expat; }
328 # TODO Somehow automatically amend buildInputs for things that need luaffi
329 # but are in luajitPackages?
330 luaffi = prev.luaffi.overrideAttrs (oa: {
331 # The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3
332 src = fetchFromGitHub {
335 rev = "532c757e51c86f546a85730b71c9fef15ffa633d";
336 sha256 = "1nwx6sh56zfq99rcs7sph0296jf6a9z72mxknn0ysw9fd7m1r8ig";
338 knownRockspec = with prev.luaffi; "${pname}-${version}.rockspec";
339 meta.broken = luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT;
342 lualdap = prev.lualdap.overrideAttrs (_: {
344 { name = "LDAP"; dep = openldap; }
348 luaossl = prev.luaossl.overrideAttrs (_: {
350 { name = "CRYPTO"; dep = openssl; }
351 { name = "OPENSSL"; dep = openssl; }
355 luaposix = prev.luaposix.overrideAttrs (_: {
357 { name = "CRYPT"; dep = libxcrypt; }
361 luasec = prev.luasec.overrideAttrs (oa: {
363 { name = "OPENSSL"; dep = openssl; }
367 luasql-sqlite3 = prev.luasql-sqlite3.overrideAttrs (oa: {
369 { name = "SQLITE"; dep = sqlite; }
373 luasystem = prev.luasystem.overrideAttrs (oa: lib.optionalAttrs stdenv.isLinux {
374 buildInputs = [ glibc.out ];
377 luazip = prev.luazip.overrideAttrs (oa: {
378 buildInputs = oa.buildInputs ++ [
383 # lua-resty-session = prev.lua-resty-session.overrideAttrs (oa: {
384 # # lua_pack and lua-ffi-zlib are unpackaged, causing this package to not evaluate
385 # meta.broken = true;
388 lua-yajl = prev.lua-yajl.overrideAttrs (oa: {
389 buildInputs = oa.buildInputs ++ [
394 luaunbound = prev.luaunbound.overrideAttrs (oa: {
396 { name = "libunbound"; dep = unbound; }
400 lua-subprocess = prev.lua-subprocess.overrideAttrs (oa: {
401 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
404 lua-rtoml = prev.lua-rtoml.overrideAttrs (oa: {
406 cargoDeps = rustPlatform.fetchCargoTarball {
408 hash = "sha256-EcP4eYsuOVeEol+kMqzsVHd8F2KoBdLzf6K0KsYToUY=";
411 propagatedBuildInputs = oa.propagatedBuildInputs ++ [ cargo rustPlatform.cargoSetupHook ];
415 lush-nvim = prev.lush-nvim.overrideAttrs (drv: {
419 luuid = prev.luuid.overrideAttrs (oa: {
421 { name = "LIBUUID"; dep = libuuid; }
423 # Trivial patch to make it work in both 5.1 and 5.2. Basically just the
424 # tiny diff between the two upstream versions placed behind an #if.
426 # 5.1: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/luuid.tar.gz
427 # 5.2: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/luuid.tar.gz
428 patchFlags = [ "-p2" ];
433 sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|'
436 broken = luaOlder "5.1" || (luaAtLeast "5.4");
437 platforms = lib.platforms.linux;
442 # as advised in https://github.com/luarocks/luarocks/issues/1402#issuecomment-1080616570
443 # we shouldn't use luarocks machinery to build complex cmake components
444 libluv = stdenv.mkDerivation {
447 inherit (prev.luv) version meta src;
450 "-DBUILD_SHARED_LIBS=ON"
452 "-DWITH_SHARED_LIBUV=ON"
453 "-DLUA_BUILD_TYPE=System"
454 "-DWITH_LUA_ENGINE=${if isLuaJIT then "LuaJit" else "Lua"}"
457 # to make sure we dont use bundled deps
459 rm -rf deps/lua deps/libuv
462 buildInputs = [ libuv final.lua ];
464 nativeBuildInputs = [ pkg-config cmake ]
465 ++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
468 luv = prev.luv.overrideAttrs (oa: {
470 nativeBuildInputs = oa.nativeBuildInputs ++ [ pkg-config ];
471 buildInputs = [ libuv ];
473 # Use system libuv instead of building local and statically linking
475 WITH_SHARED_LIBUV = "ON";
478 # we unset the LUA_PATH since the hook erases the interpreter defaults (To fix)
479 # tests is not run since they are not part of the tarball anymore
482 rm tests/test-{dns,thread}.lua
486 lyaml = prev.lyaml.overrideAttrs (oa: {
492 magick = prev.magick.overrideAttrs (oa: {
493 buildInputs = oa.buildInputs ++ [
497 # Fix MagickWand not being found in the pkg-config search path
503 substituteInPlace magick/wand/lib.lua \
504 --replace @nix_wand@ ${imagemagick}/lib/libMagickWand-7.Q16HDRI.so
508 meta.broken = !isLuaJIT;
511 mpack = prev.mpack.overrideAttrs (drv: {
512 buildInputs = (drv.buildInputs or []) ++ [ libmpack ];
514 # the rockspec doesn't use the makefile so you may need to export more flags
515 USE_SYSTEM_LUA = "yes";
516 USE_SYSTEM_MPACK = "yes";
520 rapidjson = prev.rapidjson.overrideAttrs (oa: {
522 sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt
523 sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt
527 readline = final.callPackage({ buildLuarocksPackage, fetchurl, luaAtLeast, luaOlder, lua, luaposix }:
528 buildLuarocksPackage ({
531 knownRockspec = (fetchurl {
532 url = "mirror://luarocks/readline-3.2-0.rockspec";
533 sha256 = "1r0sgisxm4xd1r6i053iibxh30j7j3rcj4wwkd8rzkj8nln20z24";
536 # the rockspec url doesn't work because 'www.' is not covered by the certificate so
537 # I manually removed the 'www' prefix here
538 url = "http://pjb.com.au/comp/lua/readline-3.2.tar.gz";
539 sha256 = "1mk9algpsvyqwhnq7jlw4cgmfzj30l7n2r6ak4qxgdxgc39f48k4";
542 extraVariables = rec {
543 READLINE_INCDIR = "${readline.dev}/include";
544 HISTORY_INCDIR = READLINE_INCDIR;
551 disabled = (luaOlder "5.1") || (luaAtLeast "5.5");
552 propagatedBuildInputs = [ lua luaposix
557 homepage = "http://pjb.com.au/comp/lua/readline.html";
558 description = "Interface to the readline library";
559 license.fullName = "MIT/X11";
564 sqlite = prev.sqlite.overrideAttrs (drv: {
567 nativeCheckInputs = [ final.plenary-nvim neovim-unwrapped ];
569 # we override 'luarocks test' because otherwise neovim doesn't find/load the plenary plugin
571 export LIBSQLITE="${sqlite.out}/lib/libsqlite3${stdenv.hostPlatform.extensions.sharedLibrary}"
572 export HOME="$TMPDIR";
574 nvim --headless -i NONE \
575 -u test/minimal_init.vim --cmd "set rtp+=${vimPlugins.plenary-nvim}" \
576 -c "PlenaryBustedDirectory test/auto/ { minimal_init = './test/minimal_init.vim' }"
581 std-_debug = prev.std-_debug.overrideAttrs (oa: {
582 # run make to generate lib/std/_debug/version.lua
588 std-normalize = prev.std-normalize.overrideAttrs (oa: {
589 # run make to generate lib/std/_debug/version.lua
595 toml = prev.toml.overrideAttrs (oa: {
596 patches = [ ./toml.patch ];
598 propagatedBuildInputs = oa.propagatedBuildInputs ++ [ magic-enum sol2 ];
601 substituteInPlace CMakeLists.txt --replace \
602 "TOML_PLUS_PLUS_SRC" \
603 "${tomlplusplus.src}"
607 toml-edit = prev.toml-edit.overrideAttrs (oa: {
609 cargoDeps = rustPlatform.fetchCargoTarball {
611 hash = "sha256-pLAisfnSDoAToQO/kdKTdic6vEug7/WFNtgOfj0bRAE=";
614 nativeBuildInputs = oa.nativeBuildInputs ++ [ cargo rustPlatform.cargoSetupHook ];
618 vstruct = prev.vstruct.overrideAttrs (_: {
619 meta.broken = (luaOlder "5.1" || luaAtLeast "5.4");
622 vusted = prev.vusted.overrideAttrs (_: {
623 # make sure vusted_entry.vim doesn't get wrapped
625 chmod -x $out/bin/vusted_entry.vim
631 cjson = prev.lua-cjson;