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