1# do not add pkgs, it messes up splicing
2{ stdenv
3, cargo
4, cmake
5
6# plenary utilities
7, which
8, findutils
9, clang
10, coreutils
11, curl
12, cyrus_sasl
13, dbus
14, expat
15, fetchFromGitHub
16, fetchpatch
17, fetchurl
18, fixDarwinDylibNames
19, glib
20, glibc
21, gmp
22, gnulib
23, gnum4
24, gobject-introspection
25, imagemagick
26, installShellFiles
27, lib
28, libevent
29, libiconv
30, libmpack
31, libmysqlclient
32, libuuid
33, libuv
34, libxcrypt
35, libyaml
36, luajitPackages
37, mariadb
38, magic-enum
39, mpfr
40, neovim-unwrapped
41, openldap
42, openssl
43, pcre
44, pkg-config
45, postgresql
46, readline
47, rustPlatform
48, sol2
49, sqlite
50, tomlplusplus
51, tree-sitter
52, unbound
53, vimPlugins
54, vimUtils
55, yajl
56, zlib
57, zziplib
58}:
59
60final: prev:
61let
62 inherit (prev) luaOlder luaAtLeast lua isLuaJIT;
63in
64{
65 argparse = prev.argparse.overrideAttrs(oa: {
66
67 doCheck = true;
68 checkInputs = [ final.busted ];
69
70 checkPhase = ''
71 runHook preCheck
72 export LUA_PATH="src/?.lua;$LUA_PATH"
73 busted spec/
74 runHook postCheck
75 '';
76 });
77 ##########################################3
78 #### manual fixes for generated packages
79 ##########################################3
80 bit32 = prev.bit32.overrideAttrs (oa: {
81 # Small patch in order to no longer redefine a Lua 5.2 function that Luajit
82 # 2.1 also provides, see https://github.com/LuaJIT/LuaJIT/issues/325 for
83 # more
84 patches = [
85 ./bit32.patch
86 ];
87 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
88 });
89
90 busted = prev.busted.overrideAttrs (oa: {
91 nativeBuildInputs = oa.nativeBuildInputs ++ [
92 installShellFiles
93 ];
94 postConfigure = ''
95 substituteInPlace ''${rockspecFilename} \
96 --replace-fail "'lua_cliargs = 3.0'," "'lua_cliargs >= 3.0-1',"
97 '';
98 postInstall = ''
99 installShellCompletion --cmd busted \
100 --zsh completions/zsh/_busted \
101 --bash completions/bash/busted.bash
102 '';
103 });
104
105 cqueues = prev.cqueues.overrideAttrs (oa: rec {
106 # Parse out a version number without the Lua version inserted
107 version = with lib; let
108 version' = prev.cqueues.version;
109 rel = splitVersion version';
110 date = head rel;
111 rev = last (splitString "-" (last rel));
112 in
113 "${date}-${rev}";
114
115 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
116
117 nativeBuildInputs = oa.nativeBuildInputs ++ [
118 gnum4
119 ];
120
121 externalDeps = [
122 { name = "CRYPTO"; dep = openssl; }
123 { name = "OPENSSL"; dep = openssl; }
124 ];
125
126 # Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
127 # version, which doesn't work well for us, so modify it
128 postConfigure = let inherit (prev.cqueues) pname; in
129 ''
130 # 'all' target auto-detects correct Lua version, which is fine for us as
131 # we only have the right one available :)
132 sed -Ei ''${rockspecFilename} \
133 -e 's|lua == 5.[[:digit:]]|lua >= 5.1, <= 5.3|' \
134 -e 's|build_target = "[^"]+"|build_target = "all"|' \
135 -e 's|version = "[^"]+"|version = "${version}"|'
136 specDir=$(dirname ''${rockspecFilename})
137 cp ''${rockspecFilename} "$specDir/${pname}-${version}.rockspec"
138 rockspecFilename="$specDir/${pname}-${version}.rockspec"
139 '';
140 });
141
142 fennel = prev.fennel.overrideAttrs(oa: {
143 nativeBuildInputs = oa.nativeBuildInputs ++ [
144 installShellFiles
145 ];
146 postInstall = ''
147 installManPage fennel.1
148 '';
149 });
150
151 # Until https://github.com/swarn/fzy-lua/pull/8 is merged,
152 # we have to invoke busted manually
153 fzy = prev.fzy.overrideAttrs(oa: {
154 doCheck = true;
155 nativeCheckInputs = [ final.busted ];
156 checkPhase = ''
157 busted
158 '';
159 });
160
161 http = prev.http.overrideAttrs (oa: {
162 patches = [
163 (fetchpatch {
164 name = "invalid-state-progression.patch";
165 url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff";
166 sha256 = "1vmx039n3nqfx50faqhs3wgiw28ws416rhw6vh6srmh9i826dac7";
167 })
168 ];
169 /* TODO: separate docs derivation? (pandoc is heavy)
170 nativeBuildInputs = [ pandoc ];
171 makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ];
172 */
173 });
174
175 image-nvim = prev.image-nvim.overrideAttrs (oa: {
176 propagatedBuildInputs = [
177 lua
178 luajitPackages.magick
179 ];
180 });
181
182 ldbus = prev.ldbus.overrideAttrs (oa: {
183 luarocksConfig = oa.luarocksConfig // {
184 variables = {
185 DBUS_DIR = "${dbus.lib}";
186 DBUS_ARCH_INCDIR = "${dbus.lib}/lib/dbus-1.0/include";
187 DBUS_INCDIR = "${dbus.dev}/include/dbus-1.0";
188 };
189 };
190 buildInputs = [
191 dbus
192 ];
193 });
194
195 ljsyscall = prev.ljsyscall.overrideAttrs (oa: rec {
196 version = "unstable-20180515";
197 # package hasn't seen any release for a long time
198 src = fetchFromGitHub {
199 owner = "justincormack";
200 repo = "ljsyscall";
201 rev = "e587f8c55aad3955dddab3a4fa6c1968037b5c6e";
202 sha256 = "06v52agqyziwnbp2my3r7liv245ddmb217zmyqakh0ldjdsr8lz4";
203 };
204 knownRockspec = "rockspec/ljsyscall-scm-1.rockspec";
205 # actually library works fine with lua 5.2
206 preConfigure = ''
207 sed -i 's/lua == 5.1/lua >= 5.1, < 5.3/' ${knownRockspec}
208 '';
209 meta.broken = luaOlder "5.1" || luaAtLeast "5.3";
210
211 propagatedBuildInputs = with lib; oa.propagatedBuildInputs ++ optional (!isLuaJIT) final.luaffi;
212 });
213
214 lgi = prev.lgi.overrideAttrs (oa: {
215 nativeBuildInputs = oa.nativeBuildInputs ++ [
216 pkg-config
217 ];
218 buildInputs = [
219 glib
220 gobject-introspection
221 ];
222 patches = [
223 (fetchpatch {
224 name = "lgi-find-cairo-through-typelib.patch";
225 url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
226 sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
227 })
228 ];
229
230 # https://github.com/lgi-devs/lgi/pull/300
231 postPatch = ''
232 substituteInPlace lgi/Makefile tests/Makefile \
233 --replace 'PKG_CONFIG =' 'PKG_CONFIG ?='
234 '';
235
236 # there is only a rockspec.in in the repo, the actual rockspec must be generated
237 preConfigure = ''
238 make rock
239 '';
240
241 # Lua 5.4 support is experimental at the moment, see
242 # https://github.com/lgi-devs/lgi/pull/249
243 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
244 });
245
246 lmathx = prev.luaLib.overrideLuarocks prev.lmathx (drv:
247 if luaAtLeast "5.1" && luaOlder "5.2" then {
248 version = "20120430.51-1";
249 knownRockspec = (fetchurl {
250 url = "https://luarocks.org/lmathx-20120430.51-1.rockspec";
251 sha256 = "148vbv2g3z5si2db7rqg5bdily7m4sjyh9w6r3jnx3csvfaxyhp0";
252 }).outPath;
253 src = fetchurl {
254 url = "https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/lmathx.tar.gz";
255 sha256 = "0sa553d0zlxhvpsmr4r7d841f16yq4wr3fg7i07ibxkz6yzxax51";
256 };
257 } else
258 if luaAtLeast "5.2" && luaOlder "5.3" then {
259 version = "20120430.52-1";
260 knownRockspec = (fetchurl {
261 url = "https://luarocks.org/lmathx-20120430.52-1.rockspec";
262 sha256 = "14rd625sipakm72wg6xqsbbglaxyjba9nsajsfyvhg0sz8qjgdya";
263 }).outPath;
264 src = fetchurl {
265 url = "http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/lmathx.tar.gz";
266 sha256 = "19dwa4z266l2njgi6fbq9rak4rmx2fsx1s0p9sl166ar3mnrdwz5";
267 };
268 } else
269 {
270 disabled = luaOlder "5.1" || luaAtLeast "5.5";
271 # works fine with 5.4 as well
272 postConfigure = ''
273 substituteInPlace ''${rockspecFilename} \
274 --replace 'lua ~> 5.3' 'lua >= 5.3, < 5.5'
275 '';
276 });
277
278 lmpfrlib = prev.lmpfrlib.overrideAttrs (oa: {
279 externalDeps = [
280 { name = "GMP"; dep = gmp; }
281 { name = "MPFR"; dep = mpfr; }
282 ];
283 unpackPhase = ''
284 cp $src $(stripHash $src)
285 '';
286 });
287
288 lrexlib-gnu = prev.lrexlib-gnu.overrideAttrs (oa: {
289 buildInputs = oa.buildInputs ++ [
290 gnulib
291 ];
292 });
293
294 lrexlib-pcre = prev.lrexlib-pcre.overrideAttrs (oa: {
295 externalDeps = [
296 { name = "PCRE"; dep = pcre; }
297 ];
298 });
299
300 lrexlib-posix = prev.lrexlib-posix.overrideAttrs (oa: {
301 buildInputs = oa.buildInputs ++ [
302 glibc.dev
303 ];
304 });
305
306 lua-curl = prev.lua-curl.overrideAttrs (oa: {
307 buildInputs = oa.buildInputs ++ [
308 curl.dev
309 ];
310 });
311
312 lua-iconv = prev.lua-iconv.overrideAttrs (oa: {
313 buildInputs = oa.buildInputs ++ [
314 libiconv
315 ];
316 });
317
318 lua-lsp = prev.lua-lsp.overrideAttrs (oa: {
319 # until Alloyed/lua-lsp#28
320 postConfigure = ''
321 substituteInPlace ''${rockspecFilename} \
322 --replace '"dkjson ~> 2.5",' '"dkjson >= 2.5",'
323 '';
324 });
325
326 lua-zlib = prev.lua-zlib.overrideAttrs (oa: {
327 buildInputs = oa.buildInputs ++ [
328 zlib.dev
329 ];
330 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
331 });
332
333 luadbi-mysql = prev.luadbi-mysql.overrideAttrs (oa: {
334
335 luarocksConfig = lib.recursiveUpdate oa.luarocksConfig {
336 variables = {
337 # Can't just be /include and /lib, unfortunately needs the trailing 'mysql'
338 MYSQL_INCDIR = "${libmysqlclient.dev}/include/mysql";
339 MYSQL_LIBDIR = "${libmysqlclient}/lib/mysql";
340 };
341 };
342 buildInputs = oa.buildInputs ++ [
343 mariadb.client
344 libmysqlclient
345 ];
346 });
347
348 luadbi-postgresql = prev.luadbi-postgresql.overrideAttrs (oa: {
349 buildInputs = oa.buildInputs ++ [
350 postgresql
351 ];
352 });
353
354 luadbi-sqlite3 = prev.luadbi-sqlite3.overrideAttrs (oa: {
355 externalDeps = [
356 { name = "SQLITE"; dep = sqlite; }
357 ];
358 });
359
360 luaevent = prev.luaevent.overrideAttrs (oa: {
361 propagatedBuildInputs = oa.propagatedBuildInputs ++ [
362 final.luasocket
363 ];
364 externalDeps = [
365 { name = "EVENT"; dep = libevent; }
366 ];
367 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
368 });
369
370 luaexpat = prev.luaexpat.overrideAttrs (_: {
371 externalDeps = [
372 { name = "EXPAT"; dep = expat; }
373 ];
374 });
375
376 # TODO Somehow automatically amend buildInputs for things that need luaffi
377 # but are in luajitPackages?
378 luaffi = prev.luaffi.overrideAttrs (oa: {
379 # The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3
380 src = fetchFromGitHub {
381 owner = "facebook";
382 repo = "luaffifb";
383 rev = "532c757e51c86f546a85730b71c9fef15ffa633d";
384 sha256 = "1nwx6sh56zfq99rcs7sph0296jf6a9z72mxknn0ysw9fd7m1r8ig";
385 };
386 knownRockspec = with prev.luaffi; "${pname}-${version}.rockspec";
387 meta.broken = luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT;
388 });
389
390 lualdap = prev.lualdap.overrideAttrs (_: {
391 externalDeps = [
392 { name = "LDAP"; dep = openldap; }
393 ];
394 });
395
396 luaossl = prev.luaossl.overrideAttrs (_: {
397 externalDeps = [
398 { name = "CRYPTO"; dep = openssl; }
399 { name = "OPENSSL"; dep = openssl; }
400 ];
401 });
402
403 luaposix = prev.luaposix.overrideAttrs (_: {
404 externalDeps = [
405 { name = "CRYPT"; dep = libxcrypt; }
406 ];
407 });
408
409 luasec = prev.luasec.overrideAttrs (oa: {
410 externalDeps = [
411 { name = "OPENSSL"; dep = openssl; }
412 ];
413 });
414
415 luasql-sqlite3 = prev.luasql-sqlite3.overrideAttrs (oa: {
416 externalDeps = [
417 { name = "SQLITE"; dep = sqlite; }
418 ];
419 });
420
421 luasystem = prev.luasystem.overrideAttrs (oa: lib.optionalAttrs stdenv.isLinux {
422 buildInputs = [ glibc.out ];
423 });
424
425 luazip = prev.luazip.overrideAttrs (oa: {
426 buildInputs = oa.buildInputs ++ [
427 zziplib
428 ];
429 });
430
431 # lua-resty-session = prev.lua-resty-session.overrideAttrs (oa: {
432 # # lua_pack and lua-ffi-zlib are unpackaged, causing this package to not evaluate
433 # meta.broken = true;
434 # });
435
436 lua-resty-openidc = prev.lua-resty-openidc.overrideAttrs (_: {
437 postConfigure = ''
438 substituteInPlace ''${rockspecFilename} \
439 --replace '"lua-resty-session >= 2.8, <= 3.10",' '"lua-resty-session >= 2.8",'
440 '';
441 });
442
443 lua-yajl = prev.lua-yajl.overrideAttrs (oa: {
444 buildInputs = oa.buildInputs ++ [
445 yajl
446 ];
447 });
448
449 luaunbound = prev.luaunbound.overrideAttrs (oa: {
450 externalDeps = [
451 { name = "libunbound"; dep = unbound; }
452 ];
453 });
454
455 lua-subprocess = prev.lua-subprocess.overrideAttrs (oa: {
456 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
457 });
458
459 lua-rtoml = prev.lua-rtoml.overrideAttrs (oa: {
460
461 cargoDeps = rustPlatform.fetchCargoTarball {
462 src = oa.src;
463 hash = "sha256-EcP4eYsuOVeEol+kMqzsVHd8F2KoBdLzf6K0KsYToUY=";
464 };
465
466 propagatedBuildInputs = oa.propagatedBuildInputs ++ [ cargo rustPlatform.cargoSetupHook ];
467
468 });
469
470 lush-nvim = prev.lush-nvim.overrideAttrs (drv: {
471 doCheck = false;
472 });
473
474 luuid = prev.luuid.overrideAttrs (oa: {
475 externalDeps = [
476 { name = "LIBUUID"; dep = libuuid; }
477 ];
478 # Trivial patch to make it work in both 5.1 and 5.2. Basically just the
479 # tiny diff between the two upstream versions placed behind an #if.
480 # Upstreams:
481 # 5.1: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/luuid.tar.gz
482 # 5.2: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/luuid.tar.gz
483 patchFlags = [ "-p2" ];
484 patches = [
485 ./luuid.patch
486 ];
487 postConfigure = ''
488 sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|'
489 '';
490 meta = oa.meta // {
491 broken = luaOlder "5.1" || (luaAtLeast "5.4");
492 platforms = lib.platforms.linux;
493 };
494 });
495
496 haskell-tools-nvim = prev.haskell-tools-nvim.overrideAttrs(oa: {
497 doCheck = lua.luaversion == "5.1";
498 nativeCheckInputs = [ final.nlua final.busted ];
499 checkPhase = ''
500 runHook preCheck
501 export HOME=$(mktemp -d)
502 busted --lua=nlua
503 runHook postCheck
504 '';
505 });
506
507 plenary-nvim = prev.plenary-nvim.overrideAttrs (oa: {
508 postPatch = ''
509 sed -Ei lua/plenary/curl.lua \
510 -e 's@(command\s*=\s*")curl(")@\1${curl}/bin/curl\2@'
511 '';
512
513 # disabled for now because too flaky
514 doCheck = false;
515 # for env/find/ls
516 checkInputs = [
517 which
518 neovim-unwrapped
519 coreutils
520 findutils
521 ];
522
523 checkPhase = ''
524 runHook preCheck
525 # remove failing tests, need internet access for instance
526 rm tests/plenary/job_spec.lua tests/plenary/scandir_spec.lua tests/plenary/curl_spec.lua
527 export HOME="$TMPDIR"
528 make test
529 runHook postCheck
530 '';
531 });
532
533 # as advised in https://github.com/luarocks/luarocks/issues/1402#issuecomment-1080616570
534 # we shouldn't use luarocks machinery to build complex cmake components
535 libluv = stdenv.mkDerivation {
536
537 pname = "libluv";
538 inherit (prev.luv) version meta src;
539
540 cmakeFlags = [
541 "-DBUILD_SHARED_LIBS=ON"
542 "-DBUILD_MODULE=OFF"
543 "-DWITH_SHARED_LIBUV=ON"
544 "-DLUA_BUILD_TYPE=System"
545 "-DWITH_LUA_ENGINE=${if isLuaJIT then "LuaJit" else "Lua"}"
546 ];
547
548 # to make sure we dont use bundled deps
549 postUnpack = ''
550 rm -rf deps/lua deps/libuv
551 '';
552
553 buildInputs = [ libuv final.lua ];
554
555 nativeBuildInputs = [ pkg-config cmake ]
556 ++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];
557 };
558
559 luv = prev.luv.overrideAttrs (oa: {
560
561 nativeBuildInputs = oa.nativeBuildInputs ++ [ pkg-config ];
562 buildInputs = [ libuv ];
563
564 # Use system libuv instead of building local and statically linking
565 luarocksConfig = lib.recursiveUpdate oa.luarocksConfig {
566 variables = { WITH_SHARED_LIBUV = "ON"; };
567 };
568
569 # we unset the LUA_PATH since the hook erases the interpreter defaults (To fix)
570 # tests is not run since they are not part of the tarball anymore
571 preCheck = ''
572 unset LUA_PATH
573 rm tests/test-{dns,thread}.lua
574 '';
575 });
576
577 lyaml = prev.lyaml.overrideAttrs (oa: {
578 buildInputs = [
579 libyaml
580 ];
581 });
582
583 magick = prev.magick.overrideAttrs (oa: {
584 buildInputs = oa.buildInputs ++ [
585 imagemagick
586 ];
587
588 # Fix MagickWand not being found in the pkg-config search path
589 patches = [
590 ./magick.patch
591 ];
592
593 postPatch = ''
594 substituteInPlace magick/wand/lib.lua \
595 --replace @nix_wand@ ${imagemagick}/lib/libMagickWand-7.Q16HDRI${stdenv.hostPlatform.extensions.sharedLibrary}
596 '';
597
598 # Requires ffi
599 meta.broken = !isLuaJIT;
600 });
601
602 mpack = prev.mpack.overrideAttrs (drv: {
603 buildInputs = (drv.buildInputs or []) ++ [ libmpack ];
604 env = {
605 # the rockspec doesn't use the makefile so you may need to export more flags
606 USE_SYSTEM_LUA = "yes";
607 USE_SYSTEM_MPACK = "yes";
608 };
609 });
610
611 nlua = prev.nlua.overrideAttrs(oa: {
612
613 # patchShebang removes the nvim in nlua's shebang so we hardcode one
614 postFixup = ''
615 sed -i -e "1 s|.*|#\!${coreutils}/bin/env -S ${neovim-unwrapped}/bin/nvim -l|" "$out/bin/nlua"
616 '';
617 dontPatchShebangs = true;
618 });
619
620 rapidjson = prev.rapidjson.overrideAttrs (oa: {
621 preBuild = ''
622 sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt
623 sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt
624 '';
625 });
626
627 # upstream broken, can't be generated, so moved out from the generated set
628 readline = final.callPackage({ buildLuarocksPackage, fetchurl, luaAtLeast, luaOlder, lua, luaposix }:
629 buildLuarocksPackage ({
630 pname = "readline";
631 version = "3.2-0";
632 knownRockspec = (fetchurl {
633 url = "mirror://luarocks/readline-3.2-0.rockspec";
634 sha256 = "1r0sgisxm4xd1r6i053iibxh30j7j3rcj4wwkd8rzkj8nln20z24";
635 }).outPath;
636 src = fetchurl {
637 # the rockspec url doesn't work because 'www.' is not covered by the certificate so
638 # I manually removed the 'www' prefix here
639 url = "http://pjb.com.au/comp/lua/readline-3.2.tar.gz";
640 sha256 = "1mk9algpsvyqwhnq7jlw4cgmfzj30l7n2r6ak4qxgdxgc39f48k4";
641 };
642
643 luarocksConfig.variables = rec {
644 READLINE_INCDIR = "${readline.dev}/include";
645 HISTORY_INCDIR = READLINE_INCDIR;
646 };
647 unpackCmd = ''
648 unzip "$curSrc"
649 tar xf *.tar.gz
650 '';
651
652 propagatedBuildInputs = [
653 luaposix
654 readline.out
655 ];
656
657 meta = {
658 homepage = "http://pjb.com.au/comp/lua/readline.html";
659 description = "Interface to the readline library";
660 license.fullName = "MIT/X11";
661 broken = (luaOlder "5.1") || (luaAtLeast "5.5");
662 };
663 })) {};
664
665
666 sqlite = prev.sqlite.overrideAttrs (drv: {
667
668 doCheck = true;
669 nativeCheckInputs = [ final.plenary-nvim neovim-unwrapped ];
670
671 # we override 'luarocks test' because otherwise neovim doesn't find/load the plenary plugin
672 checkPhase = ''
673 export LIBSQLITE="${sqlite.out}/lib/libsqlite3${stdenv.hostPlatform.extensions.sharedLibrary}"
674 export HOME="$TMPDIR";
675
676 nvim --headless -i NONE \
677 -u test/minimal_init.vim --cmd "set rtp+=${vimPlugins.plenary-nvim}" \
678 -c "PlenaryBustedDirectory test/auto/ { minimal_init = './test/minimal_init.vim' }"
679 '';
680
681 });
682
683 std-_debug = prev.std-_debug.overrideAttrs (oa: {
684 # run make to generate lib/std/_debug/version.lua
685 preConfigure = ''
686 make all
687 '';
688 });
689
690 std-normalize = prev.std-normalize.overrideAttrs (oa: {
691 # run make to generate lib/std/_debug/version.lua
692 preConfigure = ''
693 make all
694 '';
695 });
696
697 tiktoken_core = prev.tiktoken_core.overrideAttrs (oa: {
698 cargoDeps = rustPlatform.fetchCargoTarball {
699 src = oa.src;
700 hash = "sha256-YApsOGfAw34zp069lyGR6FGjxty1bE23+Tic07f8zI4=";
701 };
702 nativeBuildInputs = oa.nativeBuildInputs ++ [ cargo rustPlatform.cargoSetupHook ];
703 });
704
705 toml = prev.toml.overrideAttrs (oa: {
706 patches = [ ./toml.patch ];
707
708 nativeBuildInputs = oa.nativeBuildInputs ++ [ tomlplusplus ];
709 propagatedBuildInputs = oa.propagatedBuildInputs ++ [ sol2 ];
710
711 postPatch = ''
712 substituteInPlace CMakeLists.txt \
713 --replace-fail "TOML_PLUS_PLUS_SRC" "${tomlplusplus.src}/include/toml++" \
714 --replace-fail "MAGIC_ENUM_SRC" "${magic-enum.src}/include/magic_enum"
715
716 cat CMakeLists.txt
717 '';
718 });
719
720 toml-edit = prev.toml-edit.overrideAttrs (oa: {
721
722 cargoDeps = rustPlatform.fetchCargoTarball {
723 src = oa.src;
724 hash = "sha256-2P+mokkjdj2PccQG/kAGnIoUPVnK2FqNfYpHPhsp8kw=";
725 };
726
727 nativeBuildInputs = oa.nativeBuildInputs ++ [
728 cargo
729 rustPlatform.cargoSetupHook
730 lua.pkgs.luarocks-build-rust-mlua
731 ];
732
733 });
734
735 tree-sitter-norg = prev.tree-sitter-norg.overrideAttrs (oa: {
736 nativeBuildInputs = let
737 # HACK: luarocks-nix doesn't pick up rockspec build dependencies,
738 # so we have to pass the correct package in here.
739 lua = lib.head oa.propagatedBuildInputs;
740 in oa.nativeBuildInputs ++ [
741 lua.pkgs.luarocks-build-treesitter-parser
742 ] ++ (lib.optionals stdenv.isDarwin [
743 clang
744 tree-sitter
745 ]);
746 meta.broken = (luaOlder "5.1" || stdenv.isDarwin);
747 });
748
749 vstruct = prev.vstruct.overrideAttrs (_: {
750 meta.broken = (luaOlder "5.1" || luaAtLeast "5.4");
751 });
752
753 vusted = prev.vusted.overrideAttrs (_: {
754 postConfigure = ''
755 cat ''${rockspecFilename}
756 substituteInPlace ''${rockspecFilename} \
757 --replace-fail '"luasystem = 0.2.1",' "'luasystem >= 0.2',"
758 '';
759
760 # make sure vusted_entry.vim doesn't get wrapped
761 postInstall = ''
762 chmod -x $out/bin/vusted_entry.vim
763 '';
764 });
765
766
767 # aliases
768 cjson = prev.lua-cjson;
769}