1/* This file defines the composition for Lua packages. It has
2 been factored out of all-packages.nix because there are many of
3 them. Also, because most Nix expressions for Lua packages are
4 trivial, most are actually defined here. I.e. there's no function
5 for each package in a separate file: the call to the function would
6 be almost as must code as the function itself. */
7
8{ fetchurl, stdenv, lua, callPackage, unzip, zziplib, pkgconfig
9, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat
10, glib, gobjectIntrospection, libevent, zlib, autoreconfHook, gnum4
11, mysql, postgresql, cyrus_sasl
12, fetchFromGitHub, libmpack, which, fetchpatch, writeText
13}:
14
15let
16 isLua52 = lua.luaversion == "5.2";
17 isLua53 = lua.luaversion == "5.3";
18 isLuaJIT = (builtins.parseDrvName lua.name).name == "luajit";
19
20 platformString =
21 if stdenv.isDarwin then "macosx"
22 else if stdenv.isFreeBSD then "freebsd"
23 else if stdenv.isLinux then "linux"
24 else if stdenv.isSunOS then "solaris"
25 else throw "unsupported platform";
26
27 self = _self;
28 _self = with self; {
29 inherit lua;
30 inherit (stdenv.lib) maintainers;
31
32 # helper functions for dealing with LUA_PATH and LUA_CPATH
33 getPath = lib : type : "${lib}/lib/lua/${lua.luaversion}/?.${type};${lib}/share/lua/${lua.luaversion}/?.${type}";
34 getLuaPath = lib : getPath lib "lua";
35 getLuaCPath = lib : getPath lib "so";
36
37 #define build lua package function
38 buildLuaPackage = callPackage ../development/lua-modules/generic {
39 inherit lua writeText;
40 };
41
42 luarocks = callPackage ../development/tools/misc/luarocks {
43 inherit lua;
44 };
45
46 basexx = buildLuaPackage rec {
47 version = "0.4.0";
48 name = "basexx-${version}";
49
50 src = fetchFromGitHub {
51 owner = "aiq";
52 repo = "basexx";
53 rev = "v${version}";
54 sha256 = "12y0ng9bp5b98iax35pnp0kc0mb42spv1cbywvfq6amik6l0ya7g";
55 };
56
57 buildPhase = ":";
58 installPhase = ''
59 install -Dt "$out/lib/lua/${lua.luaversion}/" \
60 lib/basexx.lua
61 '';
62
63 meta = with stdenv.lib; {
64 description = "Lua library for base2, base16, base32, base64, base85";
65 homepage = "https://github.com/aiq/basexx";
66 license = licenses.mit;
67 maintainers = with maintainers; [ vcunat ];
68 platforms = platforms.all;
69 };
70 };
71
72 bit32 = buildLuaPackage rec {
73 version = "5.3.0";
74 name = "bit32-${version}";
75
76 src = fetchFromGitHub {
77 owner = "keplerproject";
78 repo = "lua-compat-5.2";
79 rev = "bitlib-${version}";
80 sha256 = "1ipqlbvb5w394qwhm2f3w6pdrgy8v4q8sps5hh3pqz14dcqwakhj";
81 };
82
83 buildPhase = ''
84 cc ${if stdenv.isDarwin then "-bundle -undefined dynamic_lookup -all_load" else "-shared"} -Ic-api lbitlib.c -o bit32.so
85 '';
86
87 installPhase = ''
88 mkdir -p $out/lib/lua/${lua.luaversion}
89 install -p bit32.so $out/lib/lua/${lua.luaversion}
90 '';
91
92 meta = with stdenv.lib; {
93 description = "Lua 5.2 bit manipulation library";
94 homepage = "http://www.lua.org/manual/5.2/manual.html#6.7";
95 license = licenses.mit;
96 maintainers = with maintainers; [ lblasc ];
97 platforms = platforms.unix;
98 };
99 };
100
101 compat53 = buildLuaPackage rec {
102 version = "0.7";
103 name = "compat53-${version}";
104
105 src = fetchFromGitHub {
106 owner = "keplerproject";
107 repo = "lua-compat-5.3";
108 rev = "v${version}";
109 sha256 = "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz";
110 };
111
112 nativeBuildInputs = [ pkgconfig ];
113
114 postConfigure = ''
115 CFLAGS+=" -shared $(pkg-config --libs ${if isLuaJIT then "luajit" else "lua"})"
116 '';
117
118 buildPhase = ''
119 cc lstrlib.c $CFLAGS -o string.so
120 cc ltablib.c $CFLAGS -o table.so
121 cc lutf8lib.c $CFLAGS -o utf8.so
122 '';
123
124 # There's no need to separate *.lua and *.so, I guess? TODO: conventions?
125 installPhase = ''
126 install -Dt "$out/lib/lua/${lua.luaversion}/compat53" \
127 compat53/*.lua *.so
128 '';
129
130 meta = with stdenv.lib; {
131 description = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1";
132 homepage = "https://github.com/keplerproject/lua-compat-5.3";
133 license = licenses.mit;
134 maintainers = with maintainers; [ vcunat ];
135 platforms = platforms.all;
136 };
137 };
138
139 cqueues = buildLuaPackage rec {
140 name = "cqueues-${version}";
141 version = "20171014";
142
143 src = fetchurl {
144 url = "https://www.25thandclement.com/~william/projects/releases/${name}.tgz";
145 sha256 = "1dabhpn6r0hlln8vx9hxm34pfcm46qzgpb2apmziwg5z51fi4ksb";
146 };
147
148 preConfigure = ''export prefix=$out'';
149
150 nativeBuildInputs = [ gnum4 ];
151 buildInputs = [ openssl ];
152
153 meta = with stdenv.lib; {
154 description = "A type of event loop for Lua";
155 homepage = "https://www.25thandclement.com/~william/projects/cqueues.html";
156 license = licenses.mit;
157 maintainers = with maintainers; [ vcunat ];
158 platforms = platforms.unix;
159 };
160 };
161
162 fifo = buildLuaPackage rec {
163 version = "0.2";
164 name = "fifo-${version}";
165
166 src = fetchFromGitHub {
167 owner = "daurnimator";
168 repo = "fifo.lua";
169 rev = version;
170 sha256 = "1800k7h5hxsvm05bjdr65djjml678lwb0661cll78z1ys2037nzn";
171 };
172
173 buildPhase = ":";
174 installPhase = ''
175 mkdir -p "$out/lib/lua/${lua.luaversion}"
176 mv fifo.lua "$out/lib/lua/${lua.luaversion}/"
177 '';
178
179 meta = with stdenv.lib; {
180 description = "A lua library/'class' that implements a FIFO";
181 homepage = "https://github.com/daurnimator/fifo.lua";
182 license = licenses.mit;
183 maintainers = with maintainers; [ vcunat ];
184 platforms = platforms.all;
185 };
186 };
187
188 luabitop = buildLuaPackage rec {
189 version = "1.0.2";
190 name = "bitop-${version}";
191
192 src = fetchurl {
193 url = "http://bitop.luajit.org/download/LuaBitOp-${version}.tar.gz";
194 sha256 = "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj";
195 };
196
197 buildFlags = stdenv.lib.optionalString stdenv.isDarwin "macosx";
198
199 disabled = isLua53;
200
201 postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
202 substituteInPlace Makefile --replace 10.4 10.5
203 '';
204
205 preBuild = ''
206 makeFlagsArray=(
207 ${stdenv.lib.optionalString stdenv.cc.isClang "CC=$CC"}
208 INCLUDES="-I${lua}/include"
209 LUA="${lua}/bin/lua");
210 '';
211
212 installPhase = ''
213 mkdir -p $out/lib/lua/${lua.luaversion}
214 install -p bit.so $out/lib/lua/${lua.luaversion}
215 '';
216
217 meta = with stdenv.lib; {
218 description = "C extension module for Lua which adds bitwise operations on numbers";
219 homepage = "http://bitop.luajit.org";
220 license = licenses.mit;
221 maintainers = with maintainers; [ ];
222 };
223 };
224
225 http = buildLuaPackage rec {
226 version = "0.2";
227 name = "http-${version}";
228
229 src = fetchFromGitHub {
230 owner = "daurnimator";
231 repo = "lua-http";
232 rev = "v${version}";
233 sha256 = "0a8vsj49alaf1fkhv51n5mgpjq8izfff3shcjs8xk7p2bc46vd7i";
234 };
235
236 /* TODO: separate docs derivation? (pandoc is heavy)
237 nativeBuildInputs = [ pandoc ];
238 makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ];
239 */
240
241 buildPhase = ":";
242 installPhase = ''
243 install -Dt "$out/lib/lua/${lua.luaversion}/http" \
244 http/*.lua
245 install -Dt "$out/lib/lua/${lua.luaversion}/http/compat" \
246 http/compat/*.lua
247 '';
248
249 meta = with stdenv.lib; {
250 description = "HTTP library for lua";
251 homepage = "https://daurnimator.github.io/lua-http/${version}/";
252 license = licenses.mit;
253 maintainers = with maintainers; [ vcunat ];
254 };
255 };
256
257 luacheck = buildLuaPackage rec {
258 pname = "luacheck";
259 version = "0.20.0";
260 name = "${pname}-${version}";
261
262 src = fetchFromGitHub {
263 owner = "mpeterv";
264 repo = "luacheck";
265 rev = "${version}";
266 sha256 = "0ahfkmqcjhlb7r99bswy1sly6d7p4pyw5f4x4fxnxzjhbq0c5qcs";
267 };
268
269 propagatedBuildInputs = [ lua ];
270
271 # No Makefile.
272 dontBuild = true;
273
274 installPhase = ''
275 ${lua}/bin/lua install.lua $out
276 '';
277
278 meta = with stdenv.lib; {
279 description = "A tool for linting and static analysis of Lua code";
280 homepage = https://github.com/mpeterv/luacheck;
281 license = licenses.mit;
282 maintainers = with maintainers; [ vyp ];
283 platforms = platforms.unix;
284 };
285 };
286
287 luacyrussasl = buildLuaPackage rec {
288 version = "1.1.0";
289 name = "lua-cyrussasl-${version}";
290 src = fetchFromGitHub {
291 owner = "JorjBauer";
292 repo = "lua-cyrussasl";
293 rev = "v${version}";
294 sha256 = "14kzm3vk96k2i1m9f5zvpvq4pnzaf7s91h5g4h4x2bq1mynzw2s1";
295 };
296
297 preBuild = ''
298 makeFlagsArray=(
299 CFLAGS="-O2 -fPIC"
300 LDFLAGS="-O -shared -fpic -lsasl2"
301 LUAPATH="$out/share/lua/${lua.luaversion}"
302 CPATH="$out/lib/lua/${lua.luaversion}"
303 );
304 mkdir -p $out/{share,lib}/lua/${lua.luaversion}
305 '';
306
307 buildInputs = [ cyrus_sasl ];
308
309 meta = with stdenv.lib; {
310 homepage = "https://github.com/JorjBauer/lua-cyrussasl";
311 description = "Cyrus SASL library for Lua 5.1+";
312 license = licenses.bsd3;
313 };
314 };
315
316 luaevent = buildLuaPackage rec {
317 version = "0.4.4";
318 name = "luaevent-${version}";
319
320 src = fetchFromGitHub {
321 owner = "harningt";
322 repo = "luaevent";
323 rev = "v${version}";
324 sha256 = "1krzxr0jkv3gmhpckp02byhdd9s5dd0hpyqc8irc8i79dd8x0p53";
325 };
326
327 preBuild = ''
328 makeFlagsArray=(
329 INSTALL_DIR_LUA="$out/share/lua/${lua.luaversion}"
330 INSTALL_DIR_BIN="$out/lib/lua/${lua.luaversion}"
331 LUA_INC_DIR="${lua}/include"
332 );
333 '';
334
335 buildInputs = [ libevent ];
336
337 propagatedBuildInputs = [ luasocket ];
338
339 meta = with stdenv.lib; {
340 homepage = http://luaforge.net/projects/luaevent/;
341 description = "Binding of libevent to Lua";
342 license = licenses.mit;
343 maintainers = with maintainers; [ koral ];
344 };
345 };
346
347 luaexpat = buildLuaPackage rec {
348 version = "1.3.0";
349 name = "expat-${version}";
350
351 src = fetchurl {
352 url = "https://matthewwild.co.uk/projects/luaexpat/luaexpat-${version}.tar.gz";
353 sha256 = "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h";
354 };
355
356 buildInputs = [ expat ];
357
358 preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
359 substituteInPlace Makefile \
360 --replace '-shared' '-bundle -undefined dynamic_lookup -all_load'
361 '';
362
363 preBuild = ''
364 makeFlagsArray=(
365 LUA_LDIR="$out/share/lua/${lua.luaversion}"
366 LUA_INC="-I${lua}/include" LUA_CDIR="$out/lib/lua/${lua.luaversion}"
367 EXPAT_INC="-I${expat.dev}/include");
368 '';
369
370 disabled = isLua53 || isLuaJIT;
371
372 meta = with stdenv.lib; {
373 description = "SAX XML parser based on the Expat library";
374 homepage = "http://matthewwild.co.uk/projects/luaexpat";
375 license = licenses.mit;
376 maintainers = with maintainers; [ flosse ];
377 platforms = platforms.unix;
378 };
379 };
380
381 luadbi = buildLuaPackage rec {
382 name = "luadbi-${version}";
383 version = "0.5";
384 src = fetchurl {
385 url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/luadbi/luadbi.${version}.tar.gz";
386 sha256 = "07ikxgxgfpimnwf7zrqwcwma83ss3wm2nzjxpwv2a1c0vmc684a9";
387 };
388 sourceRoot = ".";
389
390 buildInputs = [ mysql.connector-c postgresql sqlite ];
391
392 preConfigure = ''
393 substituteInPlace Makefile --replace CC=gcc CC=cc
394 '' + stdenv.lib.optionalString stdenv.isDarwin ''
395 substituteInPlace Makefile \
396 --replace '-shared' '-bundle -undefined dynamic_lookup -all_load'
397 '';
398
399 NIX_CFLAGS_COMPILE = [
400 "-I${mysql.connector-c}/include/mysql"
401 "-L${mysql.connector-c}/lib/mysql"
402 "-I${postgresql}/include/server"
403 ];
404
405 installPhase = ''
406 mkdir -p $out/lib/lua/${lua.luaversion}
407 install -p DBI.lua *.so $out/lib/lua/${lua.luaversion}
408 '';
409
410 meta = with stdenv.lib; {
411 homepage = "https://code.google.com/archive/p/luadbi/";
412 platforms = stdenv.lib.platforms.unix;
413 };
414 };
415
416 luafilesystem = buildLuaPackage rec {
417 version = "1.7.0";
418 name = "filesystem-${version}";
419
420 src = fetchFromGitHub {
421 owner = "keplerproject";
422 repo = "luafilesystem";
423 rev = "v${stdenv.lib.replaceChars ["."] ["_"] version}";
424 sha256 = "0fibrasshlgpa71m9wkpjxwmylnxpcf06rpqbaa0qwvqh94nhwby";
425 };
426
427 preConfigure = ''
428 substituteInPlace config --replace "CC= gcc" "";
429 ''
430 + stdenv.lib.optionalString stdenv.isDarwin ''
431 substituteInPlace config \
432 --replace 'LIB_OPTION= -shared' '###' \
433 --replace '#LIB_OPTION= -bundle' 'LIB_OPTION= -bundle'
434 substituteInPlace Makefile --replace '10.3' '10.5'
435 '';
436
437 meta = with stdenv.lib; {
438 description = "Lua library complementing filesystem-related functions";
439 homepage = "https://github.com/keplerproject/luafilesystem";
440 license = licenses.mit;
441 maintainers = with maintainers; [ flosse ];
442 platforms = platforms.unix;
443 };
444 };
445
446 luaossl = buildLuaPackage rec {
447 name = "luaossl-${version}";
448 version = "20170903";
449
450 src = fetchurl {
451 url = "https://www.25thandclement.com/~william/projects/releases/${name}.tgz";
452 sha256 = "10392bvd0lzyibipblgiss09zlqh3a5zgqg1b9lgbybpqb9cv2k3";
453 };
454
455 preConfigure = ''export prefix=$out'';
456
457 buildInputs = [ openssl ];
458
459 meta = with stdenv.lib; {
460 description = "Comprehensive binding to OpenSSL for Lua 5.1+";
461 homepage = "https://www.25thandclement.com/~william/projects/luaossl.html";
462 license = licenses.mit;
463 maintainers = with maintainers; [ vcunat ];
464 platforms = platforms.unix;
465 };
466 };
467
468 luaposix = buildLuaPackage rec {
469 name = "posix-${version}";
470 version = "34.0.4";
471
472 src = fetchFromGitHub {
473 owner = "luaposix";
474 repo = "luaposix";
475 rev = "release-v${version}";
476 sha256 = "0p5583vidsm7s97zihf47c34vscwgbl86axrnj44j328v45kxb2z";
477 };
478
479 propagatedBuildInputs = [ std.normalize bit32 ];
480
481 buildPhase = ''
482 ${lua}/bin/lua build-aux/luke \
483 package="luaposix" \
484 version="${version}"
485 '';
486
487 installPhase = ''
488 ${lua}/bin/lua build-aux/luke install --quiet \
489 INST_LIBDIR="$out/lib/lua/${lua.luaversion}" \
490 INST_LUADIR="$out/share/lua/${lua.luaversion}"
491 '';
492
493 meta = with stdenv.lib; {
494 description = "Lua bindings for POSIX API";
495 homepage = "https://github.com/luaposix/luaposix";
496 license = licenses.mit;
497 maintainers = with maintainers; [ vyp lblasc ];
498 platforms = platforms.unix;
499 };
500 };
501
502 lpty = buildLuaPackage rec {
503 version = "1.2.1";
504 name = "lpty-${version}";
505
506 src = fetchurl {
507 url = "http://www.tset.de/downloads/lpty-${version}-1.tar.gz";
508 sha256 = "0rgvbpymcgdkzdwfag607xfscs9xyqxg0dj0qr5fv906mi183gs6";
509 };
510
511 preBuild = ''
512 makeFlagsArray=(
513 INST_LIBDIR="$out/lib/lua/${lua.luaversion}"
514 INST_LUADIR="$out/share/lua/${lua.luaversion}"
515 LUA_BINDIR="${lua}/bin"
516 LUA_INCDIR="-I${lua}/include"
517 LUA_LIBDIR="-L${lua}/lib"
518 );
519 '';
520
521 meta = with stdenv.lib; {
522 description = "PTY control for Lua";
523 homepage = "http://www.tset.de/lpty";
524 license = licenses.mit;
525 maintainers = with maintainers; [ vyp ];
526 platforms = platforms.linux;
527 };
528 };
529
530 lua-iconv = buildLuaPackage rec {
531 name = "lua-iconv-${version}";
532 version = "7";
533
534 src = fetchFromGitHub {
535 owner = "ittner";
536 repo = "lua-iconv";
537 rev = name;
538 sha256 = "0rd76966qlxfp8ypkyrbif76nxnm1acclqwfs45wz3972jsk654i";
539 };
540
541 preBuild = ''
542 makeFlagsArray=(
543 INSTALL_PATH="$out/lib/lua/${lua.luaversion}"
544 );
545 '';
546
547 meta = with stdenv.lib; {
548 description = "Lua bindings for POSIX iconv";
549 homepage = "https://ittner.github.io/lua-iconv/";
550 license = licenses.mit;
551 maintainers = with maintainers; [ richardipsum ];
552 platforms = platforms.unix;
553 };
554 };
555
556 luasec = buildLuaPackage rec {
557 name = "sec-0.6";
558
559 src = fetchFromGitHub {
560 owner = "brunoos";
561 repo = "luasec";
562 rev = "lua${name}";
563 sha256 = "0wv8l7f7na7kw5xn8mjik2wpxbizl7zvvp5s7fcwvz9kl5jdpk5b";
564 };
565
566 buildInputs = [ openssl ];
567
568 preBuild = ''
569 makeFlagsArray=(
570 ${platformString}
571 LUAPATH="$out/lib/lua/${lua.luaversion}"
572 LUACPATH="$out/lib/lua/${lua.luaversion}"
573 INC_PATH="-I${lua}/include"
574 LIB_PATH="-L$out/lib");
575 '';
576
577 meta = with stdenv.lib; {
578 description = "Lua binding for OpenSSL library to provide TLS/SSL communication";
579 homepage = "https://github.com/brunoos/luasec";
580 license = licenses.mit;
581 maintainers = with maintainers; [ flosse ];
582 platforms = platforms.unix;
583 };
584 };
585
586 luasocket = buildLuaPackage rec {
587 name = "socket-${version}";
588 version = "3.0-rc1";
589
590 src = fetchFromGitHub {
591 owner = "diegonehab";
592 repo = "luasocket";
593 rev = "v${version}";
594 sha256 = "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk";
595 };
596
597 patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
598 substituteInPlace src/makefile --replace gcc cc \
599 --replace 10.3 10.5
600 '';
601
602 preBuild = ''
603 makeFlagsArray=(
604 LUAV=${lua.luaversion}
605 PLAT=${platformString}
606 prefix=$out
607 );
608 '';
609
610 doCheck = false; # fails to find itself
611
612 installTargets = [ "install" "install-unix" ];
613
614 meta = with stdenv.lib; {
615 description = "Network support for Lua";
616 homepage = "http://w3.impa.br/~diego/software/luasocket/";
617 license = licenses.mit;
618 maintainers = with maintainers; [ ];
619 platforms = with platforms; darwin ++ linux ++ freebsd ++ illumos;
620 };
621 };
622
623 luxio = buildLuaPackage rec {
624 name = "luxio-${version}";
625 version = "13";
626
627 src = fetchurl {
628 url = "https://git.gitano.org.uk/luxio.git/snapshot/luxio-luxio-13.tar.bz2";
629 sha256 = "1hvwslc25q7k82rxk461zr1a2041nxg7sn3sw3w0y5jxf0giz2pz";
630 };
631
632 nativeBuildInputs = [ which pkgconfig ];
633
634 postPatch = ''
635 patchShebangs .
636 '';
637
638 preBuild = ''
639 makeFlagsArray=(
640 INST_LIBDIR="$out/lib/lua/${lua.luaversion}"
641 INST_LUADIR="$out/share/lua/${lua.luaversion}"
642 LUA_BINDIR="$out/bin"
643 INSTALL=install
644 );
645 '';
646
647 meta = with stdenv.lib; {
648 description = "Lightweight UNIX I/O and POSIX binding for Lua";
649 homepage = "https://www.gitano.org.uk/luxio/";
650 license = licenses.mit;
651 maintainers = with maintainers; [ richardipsum ];
652 platforms = platforms.unix;
653 };
654 };
655
656 luazip = buildLuaPackage rec {
657 name = "zip-${version}";
658 version = "2007-10-30";
659
660 src = fetchFromGitHub {
661 owner = "luaforge";
662 repo = "luazip";
663 rev = "0b8f5c958e170b1b49f05bc267bc0351ad4dfc44";
664 sha256 = "0zrrwhmzny5zbpx91bjbl77gzkvvdi3qhhviliggp0aj8w3faxsr";
665 };
666
667 buildInputs = [ zziplib ];
668
669 patches = [ ../development/lua-modules/zip.patch ];
670
671 # Does not currently work under Lua 5.2 or LuaJIT.
672 disabled = isLua52 || isLua53 || isLuaJIT;
673
674 meta = with stdenv.lib; {
675 description = "Lua library to read files stored inside zip files";
676 homepage = "https://github.com/luaforge/luazip";
677 license = licenses.mit;
678 maintainers = with maintainers; [ vyp ];
679 platforms = platforms.linux;
680 };
681 };
682
683 luazlib = buildLuaPackage rec {
684 name = "zlib-${version}";
685 version = "1.1";
686
687 src = fetchFromGitHub {
688 owner = "brimworks";
689 repo = "lua-zlib";
690 rev = "v${version}";
691 sha256 = "1520lk4xpf094xn2zallqgqhs0zb4w61l49knv9y8pmhkdkxzzgy";
692 };
693
694 buildInputs = [ zlib ];
695
696 preConfigure = ''
697 substituteInPlace Makefile --replace gcc cc --replace "-llua" ""
698 '';
699
700 preBuild = ''
701 makeFlagsArray=(
702 ${platformString}
703 LUAPATH="$out/share/lua/${lua.luaversion}"
704 LUACPATH="$out/lib/lua/${lua.luaversion}"
705 INCDIR="-I${lua}/include"
706 LIBDIR="-L${lua}/lib");
707 '';
708
709 preInstall = "mkdir -p $out/lib/lua/${lua.luaversion}";
710
711 meta = with stdenv.lib; {
712 description = "Simple streaming interface to zlib for Lua";
713 homepage = https://github.com/brimworks/lua-zlib;
714 license = licenses.mit;
715 maintainers = with maintainers; [ koral ];
716 platforms = platforms.unix;
717 };
718 };
719
720
721 luastdlib = buildLuaPackage rec {
722 name = "stdlib-${version}";
723 version = "41.2.1";
724
725 src = fetchFromGitHub {
726 owner = "lua-stdlib";
727 repo = "lua-stdlib";
728 rev = "release-v${version}";
729 sha256 = "03wd1qvkrj50fjszb2apzdkc8d5bpfbbi9pajl0vbrlzzmmi3jlq";
730 };
731
732 nativeBuildInputs = [ autoreconfHook unzip ];
733
734 meta = with stdenv.lib; {
735 description = "General Lua libraries";
736 homepage = "https://github.com/lua-stdlib/lua-stdlib";
737 license = licenses.mit;
738 maintainers = with maintainers; [ vyp ];
739 platforms = platforms.linux;
740 };
741 };
742
743 lrexlib = buildLuaPackage rec {
744 name = "lrexlib-${version}";
745 version = "2.8.0";
746
747 src = fetchFromGitHub {
748 owner = "rrthomas";
749 repo = "lrexlib";
750 rev = "rel-2-8-0";
751 sha256 = "1c62ny41b1ih6iddw5qn81gr6dqwfffzdp7q6m8x09zzcdz78zhr";
752 };
753
754 buildInputs = [ luastdlib pcre luarocks oniguruma gnulib tre glibc ];
755
756 buildPhase = let
757 luaVariable = ''LUA_PATH="${luastdlib}/share/lua/${lua.luaversion}/?/init.lua;${luastdlib}/share/lua/${lua.luaversion}/?.lua"'';
758 pcreVariable = "PCRE_DIR=${pcre.out} PCRE_INCDIR=${pcre.dev}/include";
759 onigVariable = "ONIG_DIR=${oniguruma}";
760 gnuVariable = "GNU_INCDIR=${gnulib}/lib";
761 treVariable = "TRE_DIR=${tre}";
762 posixVariable = "POSIX_DIR=${glibc.dev}";
763 in ''
764 sed -e 's@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i;@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i ${pcreVariable} ${onigVariable} ${gnuVariable} ${treVariable} ${posixVariable};@' -i Makefile
765 ${luaVariable} make
766 '';
767
768 installPhase = ''
769 mkdir -pv $out;
770 cp -r luarocks/lib $out;
771 '';
772
773 meta = with stdenv.lib; {
774 description = "Lua bindings of various regex library APIs";
775 homepage = "https://github.com/rrthomas/lrexlib";
776 license = licenses.mit;
777 maintainers = with maintainers; [ vyp ];
778 platforms = platforms.linux;
779 };
780 };
781
782 luasqlite3 = buildLuaPackage rec {
783 name = "sqlite3-${version}";
784 version = "2.3.0";
785
786 src = fetchFromGitHub {
787 owner = "LuaDist";
788 repo = "luasql-sqlite3";
789 rev = version;
790 sha256 = "05k8zs8nsdmlwja3hdhckwknf7ww5cvbp3sxhk2xd1i3ij6aa10b";
791 };
792
793 disabled = isLua53;
794
795 buildInputs = [ sqlite ];
796
797 patches = [ ../development/lua-modules/luasql.patch ];
798
799 meta = with stdenv.lib; {
800 description = "Database connectivity for Lua";
801 homepage = "https://github.com/LuaDist/luasql-sqlite3";
802 license = licenses.mit;
803 maintainers = with maintainers; [ vyp ];
804 platforms = platforms.linux;
805 };
806 };
807
808 lfs = buildLuaPackage rec {
809 name = "lfs-${version}";
810 version = "1.7.0.2";
811
812 src = fetchFromGitHub {
813 owner = "keplerproject";
814 repo = "luafilesystem";
815 rev = "v" + stdenv.lib.replaceStrings ["."] ["_"] version;
816 sha256 = "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi";
817 };
818
819 meta = with stdenv.lib; {
820 description = "Portable library for filesystem operations";
821 homepage = https://keplerproject.github.com/luafilesystem;
822 license = licenses.mit;
823 maintainers = with maintainers; [ vcunat ];
824 platforms = platforms.all;
825 };
826 };
827
828 lpeg = buildLuaPackage rec {
829 name = "lpeg-${version}";
830 version = "1.0.1";
831
832 src = fetchurl {
833 url = "http://www.inf.puc-rio.br/~roberto/lpeg/${name}.tar.gz";
834 sha256 = "62d9f7a9ea3c1f215c77e0cadd8534c6ad9af0fb711c3f89188a8891c72f026b";
835 };
836
837 preBuild = ''
838 makeFlagsArray=(CC=$CC);
839 '';
840
841 buildFlags = platformString;
842
843 installPhase = ''
844 mkdir -p $out/lib/lua/${lua.luaversion}
845 install -p lpeg.so $out/lib/lua/${lua.luaversion}
846 install -p re.lua $out/lib/lua/${lua.luaversion}
847 '';
848
849 meta = with stdenv.lib; {
850 description = "Parsing Expression Grammars For Lua";
851 homepage = "http://www.inf.puc-rio.br/~roberto/lpeg/";
852 license = licenses.mit;
853 maintainers = with maintainers; [ vyp ];
854 platforms = platforms.all;
855 };
856 };
857
858 lpeg_patterns = buildLuaPackage rec {
859 version = "0.5";
860 name = "lpeg_patterns-${version}";
861
862 src = fetchFromGitHub {
863 owner = "daurnimator";
864 repo = "lpeg_patterns";
865 rev = "v${version}";
866 sha256 = "1s3c179a64r45ffkawv9dnxw4mzwkzj00nr9z2gs5haajgpjivw6";
867 };
868
869 buildPhase = ":";
870 installPhase = ''
871 mkdir -p "$out/lib/lua/${lua.luaversion}"
872 mv lpeg_patterns "$out/lib/lua/${lua.luaversion}/"
873 '';
874
875 meta = with stdenv.lib; {
876 description = "A collection of LPEG patterns";
877 homepage = "https://github.com/daurnimator/lpeg_patterns";
878 license = licenses.mit;
879 maintainers = with maintainers; [ vcunat ];
880 inherit (lpeg.meta) platforms;
881 };
882 };
883
884 cjson = buildLuaPackage rec {
885 name = "cjson-${version}";
886 version = "2.1.0";
887
888 src = fetchurl {
889 url = "http://www.kyne.com.au/~mark/software/download/lua-${name}.tar.gz";
890 sha256 = "0y67yqlsivbhshg8ma535llz90r4zag9xqza5jx0q7lkap6nkg2i";
891 };
892
893 preBuild = ''
894 sed -i "s|/usr/local|$out|" Makefile
895 '';
896
897 makeFlags = [ "LUA_VERSION=${lua.luaversion}" ];
898
899 postInstall = ''
900 rm -rf $out/share/lua/${lua.luaversion}/cjson/tests
901 '';
902
903 installTargets = "install install-extra";
904
905 disabled = isLuaJIT;
906
907 meta = with stdenv.lib; {
908 description = "Lua C extension module for JSON support";
909 homepage = "https://www.kyne.com.au/~mark/software/lua-cjson.php";
910 license = licenses.mit;
911 maintainers = with maintainers; [ vyp ];
912 };
913 };
914
915 lgi = stdenv.mkDerivation rec {
916 name = "lgi-${version}";
917 version = "0.9.2";
918
919 src = fetchFromGitHub {
920 owner = "pavouk";
921 repo = "lgi";
922 rev = version;
923 sha256 = "03rbydnj411xpjvwsyvhwy4plm96481d7jax544mvk7apd8sd5jj";
924 };
925
926 nativeBuildInputs = [ pkgconfig ];
927 buildInputs = [ glib gobjectIntrospection lua ];
928
929 makeFlags = [ "LUA_VERSION=${lua.luaversion}" ];
930
931 preBuild = ''
932 sed -i "s|/usr/local|$out|" lgi/Makefile
933 '';
934
935 patches = [
936 (fetchpatch {
937 name = "lgi-find-cairo-through-typelib.patch";
938 url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
939 sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
940 })
941 ];
942
943 meta = with stdenv.lib; {
944 description = "GObject-introspection based dynamic Lua binding to GObject based libraries";
945 homepage = https://github.com/pavouk/lgi;
946 license = licenses.mit;
947 maintainers = with maintainers; [ lovek323 rasendubi ];
948 platforms = platforms.unix;
949 };
950 };
951
952 mpack = buildLuaPackage rec {
953 name = "mpack-${version}";
954 version = "1.0.7";
955
956 src = fetchFromGitHub {
957 owner = "libmpack";
958 repo = "libmpack-lua";
959 rev = version;
960 sha256 = "0l4k7qmwaa0zpxrlp27yp4pbbyiz3zgxywkm543q6wkzn6wmq8l8";
961 };
962
963 nativeBuildInputs = [ pkgconfig ];
964 buildInputs = [ libmpack ];
965 dontBuild = true;
966
967 postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
968 substituteInPlace Makefile \
969 --replace '-shared' '-bundle -undefined dynamic_lookup -all_load'
970 '';
971
972 installFlags = [
973 "USE_SYSTEM_LUA=yes"
974 "USE_SYSTEM_MPACK=yes"
975 "MPACK_LUA_VERSION=${lua.version}"
976 "LUA_CMOD_INSTALLDIR=$(out)/lib/lua/${lua.luaversion}"
977 ];
978
979 hardeningDisable = [ "fortify" ];
980
981 meta = with stdenv.lib; {
982 description = "Lua bindings for libmpack";
983 homepage = "https://github.com/libmpack/libmpack-lua";
984 license = licenses.mit;
985 maintainers = with maintainers; [ vyp ];
986 platforms = with platforms; linux ++ darwin;
987 };
988 };
989
990 std._debug = buildLuaPackage rec {
991 name = "std._debug-${version}";
992 version = "1.0";
993
994 src = fetchFromGitHub {
995 owner = "lua-stdlib";
996 repo = "_debug";
997 rev = "v${version}";
998 sha256 = "01kfs6k9j9zy4bvk13jx18ssfsmhlciyrni1x32qmxxf4wxyi65n";
999 };
1000
1001 # No Makefile.
1002 dontBuild = true;
1003
1004 installPhase = ''
1005 mkdir -p $out/share/lua/${lua.luaversion}/std
1006 cp -r lib/std/_debug $out/share/lua/${lua.luaversion}/std/
1007 '';
1008
1009 meta = with stdenv.lib; {
1010 description = "Manage an overall debug state, and associated hint substates.";
1011 homepage = https://lua-stdlib.github.io/_debug;
1012 license = licenses.mit;
1013 maintainers = with maintainers; [ lblasc ];
1014 platforms = platforms.unix;
1015 };
1016 };
1017
1018 std.normalize = buildLuaPackage rec {
1019 name = "std.normalize-${version}";
1020 version = "2.0.1";
1021
1022 src = fetchFromGitHub {
1023 owner = "lua-stdlib";
1024 repo = "normalize";
1025 rev = "v${version}";
1026 sha256 = "1yz96r28d2wcgky6by92a21755bf4wzpn65rdv2ps0fxywgw5rda";
1027 };
1028
1029 propagatedBuildInputs = [ std._debug ];
1030
1031 # No Makefile.
1032 dontBuild = true;
1033
1034 installPhase = ''
1035 mkdir -p $out/share/lua/${lua.luaversion}/std
1036 cp -r lib/std/normalize $out/share/lua/${lua.luaversion}/std/
1037 '';
1038
1039 meta = with stdenv.lib; {
1040 description = "Normalized Lua Functions";
1041 homepage = https://lua-stdlib.github.io/normalize;
1042 license = licenses.mit;
1043 maintainers = with maintainers; [ lblasc ];
1044 platforms = platforms.unix;
1045 };
1046 };
1047
1048 vicious = stdenv.mkDerivation rec {
1049 name = "vicious-${version}";
1050 version = "2.3.1";
1051
1052 src = fetchFromGitHub {
1053 owner = "Mic92";
1054 repo = "vicious";
1055 rev = "v${version}";
1056 sha256 = "1yzhjn8rsvjjsfycdc993ms6jy2j5jh7x3r2ax6g02z5n0anvnbx";
1057 };
1058
1059 buildInputs = [ lua ];
1060
1061 installPhase = ''
1062 mkdir -p $out/lib/lua/${lua.luaversion}/
1063 cp -r . $out/lib/lua/${lua.luaversion}/vicious/
1064 printf "package.path = '$out/lib/lua/${lua.luaversion}/?/init.lua;' .. package.path\nreturn require((...) .. '.init')\n" > $out/lib/lua/${lua.luaversion}/vicious.lua
1065 '';
1066
1067 meta = with stdenv.lib; {
1068 description = "A modular widget library for the awesome window manager";
1069 homepage = https://github.com/Mic92/vicious;
1070 license = licenses.gpl2;
1071 maintainers = with maintainers; [ makefu mic92 ];
1072 platforms = platforms.linux;
1073 };
1074 };
1075
1076}; in self