nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# do not add pkgs, it messes up splicing
2{
3 stdenv,
4 cargo,
5 cmake,
6
7 ast-grep,
8 which,
9 findutils,
10 coreutils,
11 curl,
12 dbus,
13 expat,
14 fd,
15 fetchFromGitHub,
16 fetchpatch,
17 fetchurl,
18 fzf,
19 glib,
20 gmp,
21 gnulib,
22 gnum4,
23 gobject-introspection,
24 imagemagick,
25 installShellFiles,
26 lib,
27 libc,
28 libevent,
29 libiconv,
30 libmpack,
31 libmysqlclient,
32 libpsl,
33 libpq,
34 libuuid,
35 libxcrypt,
36 libyaml,
37 lua-language-server,
38 mariadb,
39 mpfr,
40 neovim-unwrapped,
41 oniguruma,
42 openldap,
43 openssl,
44 pcre,
45 pkg-config,
46 readline,
47 ripgrep,
48 rustPlatform,
49 sqlite,
50 tree-sitter,
51 unbound,
52 unzip,
53 versionCheckHook,
54 vimPlugins,
55 yajl,
56 zip,
57 zlib,
58 zziplib,
59 writableTmpDirAsHomeHook,
60 gitMinimal,
61 getopt,
62}:
63
64final: prev:
65let
66 inherit (prev)
67 luaOlder
68 luaAtLeast
69 lua
70 isLuaJIT
71 ;
72in
73{
74 # keep-sorted start block=yes case=no newline_separated=yes
75 argparse = prev.argparse.overrideAttrs {
76 doCheck = true;
77 nativeCheckInputs = [ final.bustedCheckHook ];
78
79 preCheck = ''LUA_PATH="src/?.lua;$LUA_PATH"'';
80 bustedFlags = [ "spec/" ];
81 };
82
83 busted = prev.busted.overrideAttrs (old: {
84 nativeBuildInputs = old.nativeBuildInputs ++ [
85 installShellFiles
86 ];
87 postInstall = ''
88 installShellCompletion --cmd busted \
89 --zsh completions/zsh/_busted \
90 --bash completions/bash/busted.bash
91 '';
92 });
93
94 cjson = prev.lua-cjson;
95
96 cqueues = prev.cqueues.overrideAttrs (old: {
97 # Parse out a version number without the Lua version inserted
98 version =
99 let
100 version' = prev.cqueues.version;
101 rel = lib.splitVersion version';
102 date = lib.head rel;
103 rev = lib.last (lib.splitString "-" (lib.last rel));
104 in
105 "${date}-${rev}";
106 __intentionallyOverridingVersion = true;
107
108 meta.broken = luaOlder "5.1" || luaAtLeast "5.5";
109
110 nativeBuildInputs = old.nativeBuildInputs ++ [
111 gnum4
112 ];
113
114 externalDeps = [
115 {
116 name = "CRYPTO";
117 dep = openssl;
118 }
119 {
120 name = "OPENSSL";
121 dep = openssl;
122 }
123 ];
124
125 env = old.env // {
126 NIX_CFLAGS_COMPILE = "-std=gnu17"; # for gcc15
127 };
128
129 # Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
130 # version, which doesn't work well for us, so modify it
131 postConfigure =
132 let
133 inherit (final.cqueues) pname version;
134 in
135 ''
136 # 'all' target auto-detects correct Lua version, which is fine for us as
137 # we only have the right one available :)
138 sed -Ei ''${rockspecFilename} \
139 -e 's|lua == 5.[[:digit:]]|lua >= 5.1, <= 5.4|' \
140 -e 's|build_target = "[^"]+"|build_target = "all"|' \
141 -e 's|version = "[^"]+"|version = "${version}"|'
142 specDir=$(dirname ''${rockspecFilename})
143 cp ''${rockspecFilename} "$specDir/${pname}-${version}.rockspec"
144 rockspecFilename="$specDir/${pname}-${version}.rockspec"
145 '';
146 });
147
148 fzf-lua = prev.fzf-lua.overrideAttrs {
149 # FIXME: https://github.com/NixOS/nixpkgs/issues/431458
150 # fzf-lua throws `address already in use` on darwin
151 # Previewer transient failure
152 # UI tests fail either transiently or consistently in certain software/hardware configurations
153 doCheck = false;
154 checkInputs = [
155 fd
156 fzf
157 getopt
158 ripgrep
159 ];
160 nativeCheckInputs = [
161 neovim-unwrapped
162 writableTmpDirAsHomeHook
163 ];
164 checkPhase = ''
165 runHook preCheck
166
167 # Linking the dependencies since makefile wants to clone them each time
168 # for `make deps`
169 mkdir -p deps
170 ln -s ${vimPlugins.mini-nvim} deps/mini.nvim
171 ln -s ${vimPlugins.nvim-web-devicons} deps/nvim-web-devicons
172
173 # TODO: remove with new nvim-web-devicons release
174 # Disabled devicons test because we have old version as dep and fzf-lua checks for a new icon
175 substituteInPlace tests/files_spec.lua \
176 --replace-fail \
177 "T[\"files\"][\"icons\"] = new_set({ parametrize = { { \"devicons\" }, { \"mini\" } } })" \
178 "T[\"files\"][\"icons\"] = new_set({ parametrize = { { \"mini\" } } })"
179
180 # TODO: Figure out why 2 files extra
181 substituteInPlace tests/screenshots/tests-files_spec.lua---files---executable---1-+-args-{-\'fd\'-} \
182 --replace-fail " 99" "101" \
183 --replace-fail "99" "101"
184
185 make test
186
187 runHook postCheck
188 '';
189 };
190
191 fzy = prev.fzy.overrideAttrs {
192 doCheck = true;
193 nativeCheckInputs = [ final.bustedCheckHook ];
194 # bustedFlags = [ "." ];
195 };
196
197 grug-far-nvim = prev.grug-far-nvim.overrideAttrs {
198 doCheck = lua.luaversion == "5.1" && !stdenv.hostPlatform.isDarwin;
199 nativeCheckInputs = [
200 final.busted
201 final.mini-test
202 final.nlua
203 ripgrep
204 neovim-unwrapped
205 ];
206
207 # feel free to disable the checks. They are mostly screenshot based
208 checkPhase = ''
209 runHook preCheck
210 # feel free to disable/adjust the tests
211 rm tests/base/test_apply.lua tests/base/test_vimscript_interpreter.lua
212
213 # Dependencies needed in special location
214 mkdir -p deps/{ripgrep,astgrep}
215 mkdir {temp_test_dir,temp_history_dir}
216 ln -s ${lib.getExe ripgrep} deps/ripgrep/rg
217 ln -s ${lib.getExe ast-grep} deps/astgrep/ast-grep
218 ln -s ${vimPlugins.mini-nvim} deps/mini.nvim
219
220 # Update dependency check to respect packaged version
221 substituteInPlace lua/grug-far/test/dependencies.lua \
222 --replace-fail "local RG_VERSION = '14.1.0'" "local RG_VERSION = '${lib.getVersion ripgrep}'" \
223 --replace-fail "local SG_VERSION = '0.35.0'" "local SG_VERSION = '${lib.getVersion ast-grep}'"
224
225 make test dir=base
226 runHook postCheck
227 '';
228
229 };
230
231 haskell-tools-nvim = prev.haskell-tools-nvim.overrideAttrs {
232 doCheck = lua.luaversion == "5.1";
233 nativeCheckInputs = [
234 final.nlua
235 final.bustedCheckHook
236 writableTmpDirAsHomeHook
237 ];
238 };
239
240 ldbus = prev.ldbus.overrideAttrs (old: {
241 luarocksConfig = old.luarocksConfig // {
242 variables = {
243 DBUS_DIR = "${dbus.lib}";
244 DBUS_ARCH_INCDIR = "${dbus.lib}/lib/dbus-1.0/include";
245 DBUS_INCDIR = "${dbus.dev}/include/dbus-1.0";
246 };
247 };
248 buildInputs = [
249 dbus
250 ];
251 });
252
253 lgi = prev.lgi.overrideAttrs (old: {
254 nativeBuildInputs = old.nativeBuildInputs ++ [
255 pkg-config
256 ];
257 buildInputs = [
258 glib
259 gobject-introspection
260 ];
261 patches = [
262 (fetchpatch {
263 name = "lgi-find-cairo-through-typelib.patch";
264 url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
265 sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
266 })
267
268 # https://github.com/lgi-devs/lgi/issues/346
269 # https://gitlab.archlinux.org/archlinux/packaging/packages/lgi/-/issues/1
270 (fetchpatch {
271 name = "glib-2.86.0.patch";
272 url = "https://gitlab.archlinux.org/archlinux/packaging/packages/lgi/-/raw/05a0c9df75883da235bacd4379b769e7d7713fb9/0001-Use-TypeClass.get-instead-of-.ref.patch";
273 hash = "sha256-Z1rNv0VzVrK41rV73KiPXq9yLaNxbTOFiSd6eLZyrbY=";
274 })
275 ];
276
277 # https://github.com/lgi-devs/lgi/pull/300
278 postPatch = ''
279 substituteInPlace lgi/Makefile tests/Makefile \
280 --replace 'PKG_CONFIG =' 'PKG_CONFIG ?='
281 '';
282
283 # there is only a rockspec.in in the repo, the actual rockspec must be generated
284 preConfigure = ''
285 make rock
286 '';
287
288 # Lua 5.4 support is experimental at the moment, see
289 # https://github.com/lgi-devs/lgi/pull/249
290 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
291 });
292
293 ljsyscall = prev.ljsyscall.overrideAttrs (old: rec {
294 version = "unstable-20180515";
295 # package hasn't seen any release for a long time
296 src = fetchFromGitHub {
297 owner = "justincormack";
298 repo = "ljsyscall";
299 rev = "e587f8c55aad3955dddab3a4fa6c1968037b5c6e";
300 sha256 = "06v52agqyziwnbp2my3r7liv245ddmb217zmyqakh0ldjdsr8lz4";
301 };
302 knownRockspec = "rockspec/ljsyscall-scm-1.rockspec";
303 # actually library works fine with lua 5.2
304 preConfigure = ''
305 sed -i 's/lua == 5.1/lua >= 5.1, < 5.3/' ${knownRockspec}
306 '';
307 meta.broken = luaOlder "5.1" || luaAtLeast "5.3";
308
309 propagatedBuildInputs = old.propagatedBuildInputs ++ lib.optional (!isLuaJIT) final.luaffi;
310 });
311
312 llscheck = prev.llscheck.overrideAttrs (old: {
313 propagatedBuildInputs = old.propagatedBuildInputs ++ [ lua-language-server ];
314 });
315
316 lmathx = prev.luaLib.overrideLuarocks prev.lmathx (
317 _drv:
318 if luaAtLeast "5.1" && luaOlder "5.2" then
319 {
320 version = "20120430.51-1";
321 knownRockspec =
322 (fetchurl {
323 url = "mirror://luarocks/lmathx-20120430.51-1.rockspec";
324 sha256 = "148vbv2g3z5si2db7rqg5bdily7m4sjyh9w6r3jnx3csvfaxyhp0";
325 }).outPath;
326 src = fetchurl {
327 url = "https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/lmathx.tar.gz";
328 sha256 = "0sa553d0zlxhvpsmr4r7d841f16yq4wr3fg7i07ibxkz6yzxax51";
329 };
330 }
331 else if luaAtLeast "5.2" && luaOlder "5.3" then
332 {
333 version = "20120430.52-1";
334 knownRockspec =
335 (fetchurl {
336 url = "mirror://luarocks/lmathx-20120430.52-1.rockspec";
337 sha256 = "14rd625sipakm72wg6xqsbbglaxyjba9nsajsfyvhg0sz8qjgdya";
338 }).outPath;
339 src = fetchurl {
340 url = "http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/lmathx.tar.gz";
341 sha256 = "19dwa4z266l2njgi6fbq9rak4rmx2fsx1s0p9sl166ar3mnrdwz5";
342 };
343 }
344 else
345 {
346 disabled = luaOlder "5.1" || luaAtLeast "5.5";
347 # works fine with 5.4 as well
348 postConfigure = ''
349 substituteInPlace ''${rockspecFilename} \
350 --replace 'lua ~> 5.3' 'lua >= 5.3, < 5.5'
351 '';
352 }
353 );
354
355 lmpfrlib = prev.lmpfrlib.overrideAttrs {
356 externalDeps = [
357 {
358 name = "GMP";
359 dep = gmp;
360 }
361 {
362 name = "MPFR";
363 dep = mpfr;
364 }
365 ];
366 unpackPhase = ''
367 cp $src $(stripHash $src)
368 '';
369 };
370
371 lrexlib-gnu = prev.lrexlib-gnu.overrideAttrs (old: {
372 strictDeps = false;
373 buildInputs = old.buildInputs ++ [
374 gnulib
375 ];
376 meta.broken = isLuaJIT;
377 });
378
379 lrexlib-oniguruma = prev.lrexlib-oniguruma.overrideAttrs {
380 externalDeps = [
381 {
382 name = "ONIG";
383 dep = oniguruma;
384 }
385 ];
386 };
387
388 lrexlib-pcre = prev.lrexlib-pcre.overrideAttrs {
389 externalDeps = [
390 {
391 name = "PCRE";
392 dep = pcre;
393 }
394 ];
395 };
396
397 lrexlib-posix = prev.lrexlib-posix.overrideAttrs (old: {
398 buildInputs = old.buildInputs ++ [
399 (lib.getDev libc)
400 ];
401 });
402
403 lua-cmsgpack = prev.lua-cmsgpack.overrideAttrs {
404 strictDeps = false;
405 meta.broken = isLuaJIT;
406 };
407
408 lua-curl = prev.lua-curl.overrideAttrs (old: {
409 buildInputs = old.buildInputs ++ [
410 curl.dev
411 ];
412 });
413
414 lua-iconv = prev.lua-iconv.overrideAttrs (old: {
415 buildInputs = old.buildInputs ++ [
416 libiconv
417 ];
418 });
419
420 lua-lsp = prev.lua-lsp.overrideAttrs {
421 # until Alloyed/lua-lsp#28
422 postConfigure = ''
423 substituteInPlace ''${rockspecFilename} \
424 --replace '"dkjson ~> 2.5",' '"dkjson >= 2.5",'
425 '';
426 };
427
428 lua-resty-jwt = prev.lua-resty-jwt.overrideAttrs {
429 src = fetchFromGitHub {
430 owner = "cdbattags";
431 repo = "lua-resty-jwt";
432 rev = "v0.2.3";
433 hash = "sha256-5lnr0ka6ijfujiRjqwCPb6jzItXx45FIN8CvhR/KiB8=";
434 fetchSubmodules = true;
435 };
436 };
437
438 lua-rtoml = prev.lua-rtoml.overrideAttrs (old: {
439 strictDeps = false;
440
441 cargoDeps = rustPlatform.fetchCargoVendor {
442 inherit (old) src;
443 hash = "sha256-7mFn4dLgaxfAxtPFCc3VzcBx2HuywcZTYqCGTbaGS0k=";
444 };
445
446 propagatedBuildInputs = old.propagatedBuildInputs ++ [
447 cargo
448 rustPlatform.cargoSetupHook
449 ];
450
451 # ld: symbol(s) not found for architecture arm64
452 # clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
453 meta.broken = stdenv.hostPlatform.isDarwin;
454 });
455
456 lua-subprocess = prev.lua-subprocess.overrideAttrs {
457 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
458 };
459
460 lua-yajl = prev.lua-yajl.overrideAttrs (old: {
461 buildInputs = old.buildInputs ++ [
462 yajl
463 ];
464 luarocksConfig = old.luarocksConfig // {
465 variables = {
466 # Since yajl's outputs are split, we need to help luarocks find the
467 # include directory.
468 YAJL_INCDIR = "${lib.getDev yajl}/include";
469 };
470 };
471 });
472
473 lua-zlib = prev.lua-zlib.overrideAttrs (old: {
474 buildInputs = old.buildInputs ++ [
475 zlib.dev
476 ];
477 meta = old.meta // {
478 broken = luaOlder "5.1" || luaAtLeast "5.4";
479 };
480 });
481
482 luacheck = prev.luacheck.overrideAttrs (old: {
483 meta = old.meta // {
484 mainProgram = "luacheck";
485 };
486 });
487
488 luacov = prev.luacov.overrideAttrs (old: {
489 postInstall = ''
490 mkdir -p $out/share/lua/${lua.luaversion}/luacov/reporter/src/luacov/reporter/html
491 mv src/luacov/reporter/html/static $out/share/lua/${lua.luaversion}/luacov/reporter/src/luacov/reporter/html/static
492 '';
493 });
494
495 luadbi-mysql = prev.luadbi-mysql.overrideAttrs (old: {
496
497 luarocksConfig = lib.recursiveUpdate old.luarocksConfig {
498 variables = {
499 MYSQL_INCDIR = "${lib.getDev libmysqlclient}/include/";
500 MYSQL_LIBDIR = "${lib.getLib libmysqlclient}/lib//mysql/";
501 };
502 };
503 buildInputs = old.buildInputs ++ [
504 mariadb.client
505 libmysqlclient
506 ];
507 });
508
509 luadbi-postgresql = prev.luadbi-postgresql.overrideAttrs (old: {
510 buildInputs = old.buildInputs ++ [
511 (lib.getDev libpq)
512 ];
513 });
514
515 luadbi-sqlite3 = prev.luadbi-sqlite3.overrideAttrs {
516 externalDeps = [
517 {
518 name = "SQLITE";
519 dep = sqlite;
520 }
521 ];
522 };
523
524 luaevent = prev.luaevent.overrideAttrs (old: {
525 propagatedBuildInputs = old.propagatedBuildInputs ++ [
526 final.luasocket
527 ];
528 externalDeps = [
529 {
530 name = "EVENT";
531 dep = libevent;
532 }
533 ];
534 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
535 });
536
537 luaexpat = prev.luaexpat.overrideAttrs (_: {
538 externalDeps = [
539 {
540 name = "EXPAT";
541 dep = expat;
542 }
543 ];
544 });
545
546 luaffi = prev.luaffi.overrideAttrs {
547 # TODO Somehow automatically amend buildInputs for things that need luaffi
548 # but are in luajitPackages?
549
550 # The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3
551 src = fetchFromGitHub {
552 owner = "facebook";
553 repo = "luaffifb";
554 rev = "532c757e51c86f546a85730b71c9fef15ffa633d";
555 sha256 = "1nwx6sh56zfq99rcs7sph0296jf6a9z72mxknn0ysw9fd7m1r8ig";
556 };
557 knownRockspec = with prev.luaffi; "${pname}-${version}.rockspec";
558 meta.broken = luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT;
559 };
560
561 lualdap = prev.lualdap.overrideAttrs (_: {
562 externalDeps = [
563 {
564 name = "LDAP";
565 dep = openldap;
566 }
567 ];
568 });
569
570 lualine-nvim = prev.lualine-nvim.overrideAttrs (_: {
571 doCheck = lua.luaversion == "5.1";
572 nativeCheckInputs = [
573 final.nvim-web-devicons
574 final.bustedCheckHook
575 final.nlua
576 gitMinimal
577 writableTmpDirAsHomeHook
578 ];
579
580 bustedFlags = [
581 "tests/"
582 ];
583
584 preCheck = ''
585 LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
586 '';
587 });
588
589 luaossl = prev.luaossl.overrideAttrs (old: {
590 externalDeps = [
591 {
592 name = "CRYPTO";
593 dep = openssl;
594 }
595 {
596 name = "OPENSSL";
597 dep = openssl;
598 }
599 ];
600
601 env = old.env // {
602 NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; # for gcc15
603 };
604 });
605
606 luaposix = prev.luaposix.overrideAttrs (_: {
607 externalDeps = [
608 {
609 name = "CRYPT";
610 dep = libxcrypt;
611 }
612 ];
613 });
614
615 luaprompt = prev.luaprompt.overrideAttrs (old: {
616 externalDeps = [
617 {
618 name = "READLINE";
619 dep = readline;
620 }
621 {
622 name = "HISTORY";
623 dep = readline;
624 }
625 ];
626
627 nativeBuildInputs = old.nativeBuildInputs ++ [ installShellFiles ];
628
629 postInstall = ''
630 installManPage luap.1
631 '';
632 });
633
634 luarocks = prev.luarocks.overrideAttrs (old: {
635 # As a nix user, use this derivation instead of "luarocks_bootstrap"
636
637 nativeBuildInputs = old.nativeBuildInputs ++ [
638 installShellFiles
639 lua
640 unzip
641 versionCheckHook
642 ];
643 # cmake is just to compile packages with "cmake" buildType, not luarocks itself
644 dontUseCmakeConfigure = true;
645
646 doInstallCheck = true;
647
648 propagatedBuildInputs = [
649 zip
650 unzip
651 cmake
652 ];
653
654 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
655 installShellCompletion --cmd luarocks \
656 --bash <($out/bin/luarocks completion bash) \
657 --fish <($out/bin/luarocks completion fish) \
658 --zsh <($out/bin/luarocks completion zsh)
659
660 installShellCompletion --cmd luarocks-admin \
661 --bash <($out/bin/luarocks-admin completion bash) \
662 --fish <($out/bin/luarocks-admin completion fish) \
663 --zsh <($out/bin/luarocks-admin completion zsh)
664 '';
665
666 meta = old.meta // {
667 mainProgram = "luarocks";
668 };
669
670 });
671
672 luasec = prev.luasec.overrideAttrs {
673 externalDeps = [
674 {
675 name = "OPENSSL";
676 dep = openssl;
677 }
678 ];
679 };
680
681 luasql-sqlite3 = prev.luasql-sqlite3.overrideAttrs {
682 externalDeps = [
683 {
684 name = "SQLITE";
685 dep = sqlite;
686 }
687 ];
688 };
689
690 luasystem = prev.luasystem.overrideAttrs (
691 lib.optionalAttrs stdenv.hostPlatform.isLinux {
692 buildInputs = [ libc.out ];
693 }
694 );
695
696 luaunbound = prev.luaunbound.overrideAttrs {
697 externalDeps = [
698 {
699 name = "libunbound";
700 dep = unbound;
701 }
702 ];
703 };
704
705 luazip = prev.luazip.overrideAttrs (old: {
706 buildInputs = old.buildInputs ++ [
707 zziplib
708 ];
709 });
710
711 lush-nvim = prev.lush-nvim.overrideAttrs {
712 # Remove dangling symlink created during installation because we don't copy the source CREATE.md it links to
713 # Using a generic method because path changes depending on if building luaPackage or vimPlugin
714 postInstall = ''
715 find -L $out -type l -name "README.md" -print -delete
716 '';
717 };
718
719 luuid = prev.luuid.overrideAttrs (old: {
720 externalDeps = [
721 {
722 name = "LIBUUID";
723 dep = libuuid;
724 }
725 ];
726 # Trivial patch to make it work in both 5.1 and 5.2. Basically just the
727 # tiny diff between the two upstream versions placed behind an #if.
728 # Upstreams:
729 # 5.1: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/luuid.tar.gz
730 # 5.2: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/luuid.tar.gz
731 patchFlags = [ "-p2" ];
732 patches = [
733 ./luuid.patch
734 ];
735 postConfigure = ''
736 sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|'
737 '';
738 meta = old.meta // {
739 broken = luaOlder "5.1" || (luaAtLeast "5.4");
740 platforms = lib.platforms.linux;
741 };
742 });
743
744 lux-lua = final.callPackage ./lux-lua.nix { inherit lua; };
745
746 lyaml = prev.lyaml.overrideAttrs {
747 buildInputs = [
748 libyaml
749 ];
750 };
751
752 lz-n = prev.lz-n.overrideAttrs {
753 doCheck = lua.luaversion == "5.1";
754 nativeCheckInputs = [
755 final.nlua
756 final.bustedCheckHook
757 writableTmpDirAsHomeHook
758 ];
759 };
760
761 lze = prev.lze.overrideAttrs {
762 doCheck = lua.luaversion == "5.1";
763 nativeCheckInputs = [
764 final.nlua
765 final.bustedCheckHook
766 writableTmpDirAsHomeHook
767 ];
768 };
769
770 lzextras = prev.lzextras.overrideAttrs {
771 doCheck = lua.luaversion == "5.1";
772 nativeCheckInputs = [
773 final.nlua
774 lua.pkgs.bustedCheckHook
775 final.lze
776 ];
777 };
778
779 magick = prev.magick.overrideAttrs (old: {
780 buildInputs = old.buildInputs ++ [
781 imagemagick
782 ];
783
784 # Fix MagickWand not being found in the pkg-config search path
785 patches = [
786 ./magick.patch
787 ];
788
789 postPatch = ''
790 substituteInPlace magick/wand/lib.lua \
791 --replace @nix_wand@ ${imagemagick}/lib/libMagickWand-7.Q16HDRI${stdenv.hostPlatform.extensions.sharedLibrary}
792 '';
793
794 # Requires ffi
795 meta.broken = !isLuaJIT;
796 });
797
798 mpack = prev.mpack.overrideAttrs (drv: {
799 buildInputs = (drv.buildInputs or [ ]) ++ [ libmpack ];
800 env = {
801 # the rockspec doesn't use the makefile so you may need to export more flags
802 USE_SYSTEM_LUA = "yes";
803 USE_SYSTEM_MPACK = "yes";
804 };
805 });
806
807 neorg = prev.neorg.overrideAttrs {
808 # Relax dependencies
809 postConfigure = ''
810 substituteInPlace ''${rockspecFilename} \
811 --replace-fail "'nvim-nio ~> 1.7'," "'nvim-nio >= 1.7'," \
812 --replace-fail "'plenary.nvim == 0.1.4'," "'plenary.nvim'," \
813 --replace-fail "'nui.nvim == 0.3.0'," "'nui.nvim'," \
814 --replace-fail ", 'nvim-treesitter-legacy-api == 0.9.2'" ""
815 '';
816 };
817
818 neotest = prev.neotest.overrideAttrs (old: {
819 doCheck = stdenv.hostPlatform.isLinux;
820 nativeCheckInputs = old.nativeCheckInputs ++ [
821 final.nlua
822 final.busted
823 neovim-unwrapped
824 writableTmpDirAsHomeHook
825 ];
826
827 checkPhase = ''
828 runHook preCheck
829 export LUA_PATH="./lua/?.lua;./lua/?/init.lua;$LUA_PATH"
830
831 # TODO: Investigate if test infra issue or upstream issue
832 # Remove failing subprocess tests that require channel functionality
833 rm tests/unit/lib/subprocess_spec.lua
834
835 nvim --headless -i NONE \
836 --cmd "set rtp+=${vimPlugins.plenary-nvim}" \
837 -c "PlenaryBustedDirectory tests/ {sequential = true}"
838
839 runHook postCheck
840 '';
841 });
842
843 nfd = prev.nfd.overrideAttrs {
844 strictDeps = false;
845 };
846
847 nlua = prev.nlua.overrideAttrs {
848
849 # patchShebang removes the nvim in nlua's shebang so we hardcode one
850 postFixup = ''
851 sed -i -e "1 s|.*|#\!${coreutils}/bin/env -S ${neovim-unwrapped}/bin/nvim -l|" "$out/bin/nlua"
852 '';
853 dontPatchShebangs = true;
854 };
855
856 nvim-nio = prev.nvim-nio.overrideAttrs {
857 doCheck = lua.luaversion == "5.1";
858 nativeCheckInputs = [
859 final.nlua
860 # upstream uses PlenaryBusted which is a pain, run busted directly instead
861 final.bustedCheckHook
862 writableTmpDirAsHomeHook
863 ];
864
865 preCheck = ''
866 LUA_PATH="lua/?.lua;lua/?/init.lua;$LUA_PATH"
867 '';
868 bustedFlags = [
869 "tests/"
870 ];
871 };
872
873 orgmode = prev.orgmode.overrideAttrs {
874 strictDeps = false;
875 # Patch in tree-sitter-orgmode dependency
876 postPatch = ''
877 substituteInPlace lua/orgmode/config/init.lua \
878 --replace-fail \
879 "require('orgmode.utils.treesitter.install').install()" \
880 "pcall(function() vim.treesitter.language.add('org', { path = '${final.tree-sitter-orgmode}/lib/lua/${final.tree-sitter-orgmode.lua.luaversion}/parser/org.so'}) end)" \
881 --replace-fail \
882 "require('orgmode.utils.treesitter.install').reinstall()" \
883 "pcall(function() vim.treesitter.language.add('org', { path = '${final.tree-sitter-orgmode}/lib/lua/${final.tree-sitter-orgmode.lua.luaversion}/parser/org.so'}) end)"
884 '';
885 };
886
887 plenary-nvim = prev.plenary-nvim.overrideAttrs {
888 postPatch = ''
889 sed -Ei lua/plenary/curl.lua \
890 -e 's@(command\s*=\s*")curl(")@\1${curl}/bin/curl\2@'
891 '';
892
893 # disabled for now because too flaky
894 doCheck = false;
895 # for env/find/ls
896 checkInputs = [
897 which
898 neovim-unwrapped
899 coreutils
900 findutils
901 writableTmpDirAsHomeHook
902 ];
903
904 checkPhase = ''
905 runHook preCheck
906 # remove failing tests, need internet access for instance
907 rm tests/plenary/job_spec.lua tests/plenary/scandir_spec.lua tests/plenary/curl_spec.lua
908 make test
909 runHook postCheck
910 '';
911 };
912
913 psl = prev.psl.overrideAttrs (drv: {
914 buildInputs = drv.buildInputs or [ ] ++ [ libpsl ];
915
916 luarocksConfig.variables = drv.luarocksConfig.variables // {
917 PSL_INCDIR = lib.getDev libpsl + "/include";
918 PSL_DIR = lib.getLib libpsl;
919 };
920 });
921
922 rapidjson = prev.rapidjson.overrideAttrs {
923 preBuild = ''
924 sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt
925 sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt
926 '';
927 };
928
929 rest-nvim = prev.rest-nvim.overrideAttrs {
930 strictDeps = false;
931 };
932
933 rocks-dev-nvim = prev.rocks-dev-nvim.overrideAttrs {
934
935 # E5113: Error while calling lua chunk [...] pl.path requires LuaFileSystem
936 doCheck = luaOlder "5.2";
937 nativeCheckInputs = [
938 final.nlua
939 final.bustedCheckHook
940 ];
941 bustedFlags = [ "spec" ];
942 };
943
944 rocks-nvim = prev.rocks-nvim.overrideAttrs (oa: {
945
946 nativeCheckInputs = [
947 final.nlua
948 final.busted
949 writableTmpDirAsHomeHook
950 ];
951
952 doCheck = lua.luaversion == "5.1";
953
954 nvimSkipModules = [
955 "bootstrap" # tries to install luarocks from network
956 ];
957
958 bustedFlags = [
959 "--run=offline"
960 ];
961 });
962
963 rtp-nvim = prev.rtp-nvim.overrideAttrs {
964 doCheck = lua.luaversion == "5.1";
965 nativeCheckInputs = [
966 final.nlua
967 final.bustedCheckHook
968 writableTmpDirAsHomeHook
969 ];
970 };
971
972 rustaceanvim = prev.rustaceanvim.overrideAttrs {
973 doCheck = lua.luaversion == "5.1";
974 nativeCheckInputs = [
975 final.nlua
976 final.bustedCheckHook
977 writableTmpDirAsHomeHook
978 ];
979 };
980
981 sofa = prev.sofa.overrideAttrs (old: {
982 nativeBuildInputs = old.nativeBuildInputs ++ [
983 installShellFiles
984 ];
985 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
986 installShellCompletion --cmd sofa \
987 --bash <($out/bin/sofa --completion bash) \
988 --fish <($out/bin/sofa --completion fish) \
989 --zsh <($out/bin/sofa --completion zsh)
990 '';
991 });
992
993 sqlite = prev.sqlite.overrideAttrs {
994 doCheck = stdenv.hostPlatform.isLinux;
995 nativeCheckInputs = [
996 final.plenary-nvim
997 neovim-unwrapped
998 writableTmpDirAsHomeHook
999 ];
1000
1001 # the plugin loldds the library from either the LIBSQLITE env
1002 # or the vim.g.sqlite_clib_path variable.
1003 postPatch = ''
1004 substituteInPlace lua/sqlite/defs.lua \
1005 --replace-fail "path = vim.g.sqlite_clib_path" 'path = vim.g.sqlite_clib_path or "${sqlite.out}/lib/libsqlite3${stdenv.hostPlatform.extensions.sharedLibrary}"'
1006 '';
1007
1008 # we override 'luarocks test' because otherwise neovim doesn't find/loldd the plenary plugin
1009 checkPhase = ''
1010 nvim --headless -i NONE \
1011 -u test/minimal_init.vim --cmd "set rtp+=${vimPlugins.plenary-nvim}" \
1012 -c "PlenaryBustedDirectory test/auto/ { sequential = true, minimal_init = './test/minimal_init.vim' }"
1013 '';
1014 };
1015
1016 std-_debug = prev.std-_debug.overrideAttrs {
1017 # run make to generate lib/std/_debug/version.lua
1018 preConfigure = ''
1019 make all
1020 '';
1021 };
1022
1023 std-normalize = prev.std-normalize.overrideAttrs {
1024 # run make to generate lib/std/_debug/version.lua
1025 preConfigure = ''
1026 make all
1027 '';
1028 };
1029
1030 tiktoken_core = prev.tiktoken_core.overrideAttrs (old: {
1031 cargoDeps = rustPlatform.fetchCargoVendor {
1032 inherit (old) src;
1033 hash = "sha256-egmb4BTbORpTpVO50IcqbZU1Y0hioXLMkxxUAo05TIA=";
1034 };
1035 nativeBuildInputs = old.nativeBuildInputs ++ [
1036 cargo
1037 rustPlatform.cargoSetupHook
1038 ];
1039 });
1040
1041 tl = prev.tl.overrideAttrs (old: {
1042 preConfigure = ''
1043 rm luarocks.lock
1044 '';
1045 meta = old.meta // {
1046 mainProgram = "tl";
1047 };
1048 });
1049
1050 toml-edit = prev.toml-edit.overrideAttrs (old: {
1051
1052 cargoDeps = rustPlatform.fetchCargoVendor {
1053 inherit (old) src;
1054 hash = "sha256-ow0zefFFrU91Q2PJww2jtd6nqUjwXUtfQzjkzl/AXuo=";
1055 };
1056
1057 NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin (
1058 if lua.pkgs.isLuaJIT then "-lluajit-${lua.luaversion}" else "-llua"
1059 );
1060
1061 nativeBuildInputs = old.nativeBuildInputs ++ [
1062 cargo
1063 rustPlatform.cargoSetupHook
1064 lua.pkgs.luarocks-build-rust-mlua
1065 ];
1066
1067 });
1068
1069 tree-sitter-http = prev.tree-sitter-http.overrideAttrs (old: {
1070 strictDeps = false;
1071 propagatedBuildInputs =
1072 let
1073 # HACK: luarocks-nix puts rockspec build dependencies in the nativeBuildInputs,
1074 # but that doesn't seem to work
1075 lua = lib.head old.propagatedBuildInputs;
1076 in
1077 old.propagatedBuildInputs
1078 ++ [
1079 lua.pkgs.luarocks-build-treesitter-parser
1080 tree-sitter
1081 ];
1082
1083 nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
1084 writableTmpDirAsHomeHook
1085 ];
1086 });
1087
1088 tree-sitter-norg = prev.tree-sitter-norg.overrideAttrs (old: {
1089 propagatedBuildInputs =
1090 let
1091 # HACK: luarocks-nix puts rockspec build dependencies in the nativeBuildInputs,
1092 # but that doesn't seem to work
1093 lua = lib.head old.propagatedBuildInputs;
1094 in
1095 old.propagatedBuildInputs
1096 ++ [
1097 lua.pkgs.luarocks-build-treesitter-parser-cpp
1098 ];
1099
1100 meta.broken = lua.luaversion != "5.1";
1101 });
1102
1103 tree-sitter-orgmode = prev.tree-sitter-orgmode.overrideAttrs (old: {
1104 strictDeps = false;
1105 propagatedBuildInputs =
1106 let
1107 # HACK: luarocks-nix puts rockspec build dependencies in the nativeBuildInputs,
1108 # but that doesn't seem to work
1109 lua = lib.head old.propagatedBuildInputs;
1110 in
1111 old.propagatedBuildInputs
1112 ++ [
1113 lua.pkgs.luarocks-build-treesitter-parser
1114 ];
1115 nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
1116 writableTmpDirAsHomeHook
1117 tree-sitter
1118 ];
1119
1120 # should be fixed upstream
1121 meta.broken = lua.luaversion != "5.1";
1122 });
1123
1124 vstruct = prev.vstruct.overrideAttrs (_: {
1125 meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
1126 });
1127
1128 vusted = prev.vusted.overrideAttrs (_: {
1129 # make sure vusted_entry.vim doesn't get wrapped
1130 postInstall = ''
1131 chmod -x $out/bin/vusted_entry.vim
1132 '';
1133 });
1134
1135 # keep-sorted end
1136}