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