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