nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 1230 lines 30 kB view raw
1# The standard set of gems in nixpkgs including potential fixes. 2# 3# The gemset is derived from two points of entry: 4# - An attrset describing a gem, including version, source and dependencies 5# This is just meta data, most probably automatically generated by a tool 6# like Bundix (https://github.com/aflatter/bundix). 7# { 8# name = "bundler"; 9# version = "1.6.5"; 10# sha256 = "1s4x0f5by9xs2y24jk6krq5ky7ffkzmxgr4z1nhdykdmpsi2zd0l"; 11# dependencies = [ "rake" ]; 12# } 13# - An optional derivation that may override how the gem is built. For popular 14# gems that don't behave correctly, fixes are already provided in the form of 15# derivations. 16# 17# This separates "what to build" (the exact gem versions) from "how to build" 18# (to make gems behave if necessary). 19 20{ 21 lib, 22 fetchurl, 23 fetchpatch, 24 fetchpatch2, 25 writeScript, 26 ruby, 27 libkrb5, 28 libxml2, 29 libxslt, 30 stdenv, 31 which, 32 libiconv, 33 libpq, 34 nodejs, 35 clang, 36 sqlite, 37 zlib, 38 imagemagick, 39 lasem, 40 pkg-config, 41 ncurses, 42 xapian, 43 gpgme, 44 util-linux, 45 tzdata, 46 icu, 47 libffi, 48 libdeflate, 49 xz, 50 zstd, 51 libwebp, 52 cmake, 53 libssh2, 54 openssl, 55 openssl_1_1, 56 libmysqlclient, 57 git, 58 perl, 59 pcre2, 60 gecode_3, 61 curl, 62 libsodium, 63 snappy, 64 libossp_uuid, 65 lxc, 66 libpcap, 67 libxtst, 68 libxdmcp, 69 libpthread-stubs, 70 gtk3, 71 lerc, 72 buildRubyGem, 73 cairo, 74 expat, 75 re2, 76 rake, 77 gobject-introspection, 78 gdk-pixbuf, 79 zeromq, 80 czmq, 81 graphicsmagick, 82 libcxx, 83 file, 84 libvirt, 85 glib, 86 vips, 87 taglib, 88 libopus, 89 linux-pam, 90 libidn, 91 protobuf, 92 fribidi, 93 harfbuzz, 94 bison, 95 h3_3, 96 flex, 97 pango, 98 python3, 99 patchelf, 100 binutils, 101 freetds, 102 wrapGAppsHook3, 103 atk, 104 bundler, 105 libsass, 106 dart-sass, 107 libexif, 108 libselinux, 109 libsepol, 110 shared-mime-info, 111 libthai, 112 libdatrie, 113 DarwinTools, 114 cctools, 115 libtool, 116 discount, 117 exiv2, 118 libepoxy, 119 libxkbcommon, 120 libmaxminddb, 121 libyaml, 122 cargo, 123 rustc, 124 rustPlatform, 125 libsysprof-capture, 126 imlib2, 127 autoSignDarwinBinariesHook, 128}@args: 129 130let 131 rainbow_rake = buildRubyGem { 132 pname = "rake"; 133 gemName = "rake"; 134 source.sha256 = "01j8fc9bqjnrsxbppncai05h43315vmz9fwg28qdsgcjw9ck1d7n"; 135 type = "gem"; 136 version = "12.0.0"; 137 }; 138in 139 140{ 141 ZenTest = attrs: { 142 meta.mainProgram = "zentest"; 143 }; 144 145 atk = attrs: { 146 dependencies = attrs.dependencies ++ [ "gobject-introspection" ]; 147 nativeBuildInputs = [ 148 rake 149 bundler 150 pkg-config 151 ] 152 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 153 propagatedBuildInputs = [ 154 gobject-introspection 155 wrapGAppsHook3 156 atk 157 ]; 158 }; 159 160 bundler = 161 attrs: 162 let 163 templates = "${attrs.ruby.gemPath}/gems/${attrs.gemName}-${attrs.version}/lib/bundler/templates/"; 164 in 165 { 166 # patching shebangs would fail on the templates/Executable file, so we 167 # temporarily remove the executable flag. 168 preFixup = "chmod -x $out/${templates}/Executable"; 169 postFixup = '' 170 chmod +x $out/${templates}/Executable 171 172 # Allows to load another bundler version 173 sed -i -e "s/activate_bin_path/bin_path/g" $out/bin/bundle 174 ''; 175 }; 176 177 cairo = attrs: { 178 nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 179 buildInputs = [ 180 cairo 181 expat 182 glib 183 libsysprof-capture 184 pcre2 185 libpthread-stubs 186 libxdmcp 187 ]; 188 }; 189 190 cairo-gobject = attrs: { 191 nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 192 buildInputs = [ 193 cairo 194 expat 195 libsysprof-capture 196 pcre2 197 libpthread-stubs 198 libxdmcp 199 ]; 200 }; 201 202 charlock_holmes = attrs: { 203 buildInputs = [ 204 which 205 icu 206 zlib 207 ]; 208 }; 209 210 cld3 = attrs: { 211 nativeBuildInputs = [ pkg-config ]; 212 buildInputs = [ protobuf ]; 213 }; 214 215 cocoapods-acknowledgements = attrs: { 216 dependencies = attrs.dependencies ++ [ "cocoapods" ]; 217 }; 218 219 cocoapods-deploy = attrs: { 220 dependencies = [ "cocoapods" ]; 221 }; 222 223 cocoapods-disable-podfile-validations = attrs: { 224 dependencies = [ "cocoapods" ]; 225 }; 226 227 cocoapods-generate = attrs: { 228 dependencies = attrs.dependencies ++ [ "cocoapods" ]; 229 }; 230 231 cocoapods-git_url_rewriter = attrs: { 232 dependencies = [ "cocoapods" ]; 233 }; 234 235 cocoapods-keys = attrs: { 236 dependencies = attrs.dependencies ++ [ "cocoapods" ]; 237 }; 238 239 cocoapods-open = attrs: { 240 dependencies = [ "cocoapods" ]; 241 }; 242 243 cocoapods-try-release-fix = attrs: { 244 dependencies = [ "cocoapods" ]; 245 }; 246 247 curb = attrs: { 248 buildInputs = [ curl ]; 249 }; 250 251 curses = attrs: { 252 dontBuild = false; 253 buildInputs = [ ncurses ]; 254 patches = lib.optionals (lib.versionOlder attrs.version "1.4.5") [ 255 # Fixes incompatible function pointer type error with clang 16. Fixed in 1.4.5 and newer. 256 # Upstream issue: https://github.com/ruby/curses/issues/85 257 (fetchpatch2 { 258 url = "https://github.com/ruby/curses/commit/13e00d07c3aaed83d5f138cf268cc33c9f025d0e.patch?full_index=1"; 259 hash = "sha256-ZJ2egqj3Uwmi4KrF79dtwczpwUqFCp52/xQYUymYDmc="; 260 }) 261 ]; 262 }; 263 264 dep-selector-libgecode = attrs: { 265 USE_SYSTEM_GECODE = true; 266 postInstall = '' 267 installPath=$(cat $out/nix-support/gem-meta/install-path) 268 sed -i $installPath/lib/dep-selector-libgecode.rb -e 's@VENDORED_GECODE_DIR =.*@VENDORED_GECODE_DIR = "${gecode_3}"@' 269 ''; 270 }; 271 272 digest-sha3 = attrs: { 273 hardeningDisable = [ "format" ]; 274 }; 275 276 rdiscount = attrs: { 277 # Use discount from nixpkgs instead of vendored version 278 dontBuild = false; 279 buildInputs = [ discount ]; 280 patches = [ 281 # Adapted from Debian: 282 # https://sources.debian.org/data/main/r/ruby-rdiscount/2.1.8-1/debian/patches/01_use-system-libmarkdown.patch 283 ./rdiscount-use-nixpkgs-libmarkdown.patch 284 ]; 285 }; 286 287 ethon = attrs: { 288 dontBuild = false; 289 postPatch = '' 290 substituteInPlace lib/ethon/curls/settings.rb \ 291 --replace "libcurl" "${curl.out}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary}" 292 ''; 293 }; 294 295 exiv2 = attrs: { 296 buildFlags = [ 297 "--with-exiv2-lib=${exiv2}/lib" 298 "--with-exiv2-include=${exiv2.dev}/include" 299 ]; 300 }; 301 302 fog-dnsimple = 303 attrs: 304 lib.optionalAttrs (lib.versionOlder attrs.version "1.0.1") { 305 postInstall = '' 306 cd $(cat $out/nix-support/gem-meta/install-path) 307 rm {$out/bin,bin,../../bin}/{setup,console} 308 ''; 309 }; 310 311 redis-rack = attrs: { 312 dontBuild = false; 313 preBuild = '' 314 exec 3>&1 315 output="$(gem build $gemspec | tee >(cat - >&3))" 316 exec 3>&- 317 sed -i 's!"rake".freeze!!' $gemspec 318 ''; 319 }; 320 321 ffi-rzmq-core = attrs: { 322 postInstall = '' 323 installPath=$(cat $out/nix-support/gem-meta/install-path) 324 sed -i $installPath/lib/ffi-rzmq-core/libzmq.rb -e 's@inside_gem =.*@inside_gem = "${zeromq}/lib"@' 325 ''; 326 }; 327 328 mimemagic = attrs: { 329 FREEDESKTOP_MIME_TYPES_PATH = "${shared-mime-info}/share/mime/packages/freedesktop.org.xml"; 330 }; 331 332 mini_magick = attrs: { 333 postInstall = '' 334 installPath=$(cat $out/nix-support/gem-meta/install-path) 335 echo -e "\nENV['PATH'] += ':${graphicsmagick}/bin'\n" >> $installPath/lib/mini_magick/configuration.rb 336 ''; 337 }; 338 339 mini_racer = attrs: { 340 buildFlags = [ 341 "--with-v8-dir=\"${nodejs.libv8}\"" 342 ]; 343 dontBuild = false; 344 postPatch = '' 345 substituteInPlace ext/mini_racer_extension/extconf.rb \ 346 --replace Libv8.configure_makefile '$CPPFLAGS += " -x c++"; Libv8.configure_makefile' 347 ''; 348 }; 349 350 do_sqlite3 = attrs: { 351 buildInputs = [ sqlite ]; 352 }; 353 354 eventmachine = attrs: { 355 dontBuild = false; 356 buildInputs = [ openssl ]; 357 postPatch = '' 358 substituteInPlace ext/em.cpp \ 359 --replace 'if (bind (' 'if (::bind (' 360 ''; 361 }; 362 363 exif = attrs: { 364 buildFlags = [ "--with-exif-dir=${libexif}" ]; 365 buildInputs = [ libexif ]; 366 }; 367 368 ffi = attrs: { 369 nativeBuildInputs = [ pkg-config ]; 370 buildInputs = [ libffi ]; 371 }; 372 373 fiddle = attrs: { 374 buildInputs = [ libffi ]; 375 }; 376 377 gdk_pixbuf2 = attrs: { 378 nativeBuildInputs = [ 379 pkg-config 380 bundler 381 rake 382 ] 383 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 384 propagatedBuildInputs = [ 385 gobject-introspection 386 wrapGAppsHook3 387 gdk-pixbuf 388 ]; 389 }; 390 391 gdk3 = attrs: { 392 nativeBuildInputs = [ 393 pkg-config 394 bundler 395 rake 396 ] 397 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 398 propagatedBuildInputs = [ 399 gobject-introspection 400 wrapGAppsHook3 401 gdk-pixbuf 402 cairo 403 ]; 404 }; 405 406 gpgme = attrs: { 407 buildInputs = [ gpgme ]; 408 nativeBuildInputs = [ pkg-config ]; 409 buildFlags = [ "--use-system-libraries" ]; 410 }; 411 412 gio2 = attrs: { 413 nativeBuildInputs = [ 414 pkg-config 415 gobject-introspection 416 ] 417 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 418 buildInputs = [ 419 glib 420 libsysprof-capture 421 pcre2 422 ] 423 ++ lib.optionals stdenv.hostPlatform.isLinux [ 424 util-linux 425 libselinux 426 libsepol 427 ]; 428 }; 429 430 gitlab-markup = attrs: { meta.priority = 1; }; 431 432 gitlab-pg_query = 433 attrs: 434 lib.optionalAttrs (attrs.version == "1.3.1") { 435 dontBuild = false; 436 postPatch = '' 437 sed -i "s;'https://codeload.github.com.*';'${ 438 fetchurl { 439 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.3"; 440 sha256 = "0jfij8apzxsdabl70j42xgd5f3ka1gdcrk764nccp66164gpcchk"; 441 } 442 }';" ext/pg_query/extconf.rb 443 ''; 444 }; 445 446 parser = attrs: { 447 meta.mainProgram = "ruby-parse"; 448 }; 449 450 pg_query = 451 attrs: 452 lib.optionalAttrs (attrs.version == "2.0.2") { 453 dontBuild = false; 454 postPatch = '' 455 sed -i "s;'https://codeload.github.com.*';'${ 456 fetchurl { 457 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/13-2.0.2"; 458 sha256 = "0ms2s6hmy8qyzv4g1hj4i2p5fws1v8lrj73b2knwbp2ipd45yj7y"; 459 } 460 }';" ext/pg_query/extconf.rb 461 ''; 462 } 463 // lib.optionalAttrs (attrs.version == "1.3.0") { 464 # Needed for gitlab 465 dontBuild = false; 466 postPatch = '' 467 sed -i "s;'https://codeload.github.com.*';'${ 468 fetchurl { 469 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.4"; 470 sha256 = "0f0kshhai0pnkqj0w4kgz3fssnvwidllc31n1fysxjjzdqlr1k48"; 471 } 472 }';" ext/pg_query/extconf.rb 473 ''; 474 }; 475 476 prettier = attrs: { 477 meta.mainProgram = "rbprettier"; 478 }; 479 480 prometheus-client-mmap = 481 attrs: 482 { 483 dontBuild = false; 484 postPatch = 485 let 486 getconf = if stdenv.hostPlatform.isGnu then stdenv.cc.libc else getconf; 487 in 488 '' 489 substituteInPlace lib/prometheus/client/page_size.rb --replace "getconf" "${lib.getBin getconf}/bin/getconf" 490 ''; 491 } 492 // lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") { 493 cargoDeps = rustPlatform.fetchCargoVendor { 494 src = stdenv.mkDerivation { 495 inherit (buildRubyGem { inherit (attrs) gemName version source; }) 496 name 497 src 498 unpackPhase 499 nativeBuildInputs 500 ; 501 dontBuilt = true; 502 installPhase = '' 503 cp -R ext/fast_mmaped_file_rs $out 504 rm $out/Cargo.lock 505 cp Cargo.lock $out 506 ''; 507 }; 508 hash = "sha256-mukk+tWWeG62q4GcDzkk8TyxVsDjShz30wEj82cElt4="; 509 }; 510 511 nativeBuildInputs = [ 512 cargo 513 rustc 514 rustPlatform.cargoSetupHook 515 rustPlatform.bindgenHook 516 ]; 517 518 disallowedReferences = [ 519 rustc.unwrapped 520 ]; 521 522 preInstall = '' 523 export CARGO_HOME="$PWD/../.cargo/" 524 ''; 525 526 postInstall = '' 527 find $out -type f -name .rustc_info.json -delete 528 ''; 529 }; 530 531 glib2 = attrs: { 532 nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 533 buildInputs = [ 534 glib 535 libsysprof-capture 536 pcre2 537 ]; 538 }; 539 540 gtk3 = attrs: { 541 nativeBuildInputs = [ 542 binutils 543 pkg-config 544 ] 545 ++ lib.optionals stdenv.hostPlatform.isLinux [ 546 util-linux 547 libselinux 548 libsepol 549 ] 550 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 551 propagatedBuildInputs = [ 552 atk 553 gdk-pixbuf 554 fribidi 555 gobject-introspection 556 gtk3 557 libdeflate 558 xz 559 libwebp 560 zstd 561 cairo 562 harfbuzz 563 lerc 564 libdatrie 565 libsysprof-capture 566 libthai 567 pcre2 568 libpthread-stubs 569 libxdmcp 570 libxtst 571 libxkbcommon 572 libepoxy 573 ]; 574 dontStrip = stdenv.hostPlatform.isDarwin; 575 }; 576 577 gobject-introspection = attrs: { 578 nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 579 propagatedBuildInputs = [ 580 gobject-introspection 581 wrapGAppsHook3 582 glib 583 pcre2 584 libsysprof-capture 585 ]; 586 }; 587 588 gollum = attrs: { 589 dontBuild = false; 590 postPatch = '' 591 substituteInPlace bin/gollum \ 592 --replace "/usr/bin/env -S ruby" "${ruby}/bin/ruby" 593 ''; 594 }; 595 596 google-protobuf = 597 attrs: 598 lib.optionalAttrs (lib.versionAtLeast attrs.version "3.25.0") { 599 # Fails on 3.25.0 with: 600 # convert.c:312:32: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security] 601 hardeningDisable = [ "format" ]; 602 }; 603 604 grpc = attrs: { 605 nativeBuildInputs = [ 606 pkg-config 607 ] 608 ++ lib.optional stdenv.hostPlatform.isDarwin cctools 609 ++ lib.optional ( 610 lib.versionAtLeast attrs.version "1.53.0" 611 && stdenv.hostPlatform.isDarwin 612 && stdenv.hostPlatform.isAarch64 613 ) autoSignDarwinBinariesHook; 614 buildInputs = [ openssl ]; 615 hardeningDisable = [ "format" ]; 616 env = lib.optionalAttrs (lib.versionOlder attrs.version "1.68.1") { 617 NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; 618 }; 619 patches = lib.optionals (lib.versionOlder attrs.version "1.65.0") [ 620 (fetchpatch { 621 name = "gcc-14-fixes.patch"; 622 url = "https://boringssl.googlesource.com/boringssl/+/c70190368c7040c37c1d655f0690bcde2b109a0d%5E%21/?format=TEXT"; 623 decode = "base64 -d"; 624 stripLen = 1; 625 extraPrefix = "third_party/boringssl-with-bazel/src/"; 626 hash = "sha256-1QyQm5s55op268r72dfExNGV+UyV5Ty6boHa9DQq40U="; 627 }) 628 ]; 629 dontBuild = false; 630 postPatch = '' 631 substituteInPlace Makefile \ 632 --replace '-Wno-invalid-source-encoding' "" 633 '' 634 + lib.optionalString (lib.versionOlder attrs.version "1.53.0" && stdenv.hostPlatform.isDarwin) '' 635 # For < v1.48.0 636 substituteInPlace src/ruby/ext/grpc/extconf.rb \ 637 --replace "ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/" "" 638 # For >= v1.48.0 639 substituteInPlace src/ruby/ext/grpc/extconf.rb \ 640 --replace 'apple_toolchain = ' 'apple_toolchain = false && ' 641 ''; 642 }; 643 644 h3 = attrs: { 645 # This gem attempts to build h3 using cmake, but fails because that is not in the path 646 # Use h3 from nixpkgs instead, and reduce closure size by deleting the h3 source code 647 dontBuild = false; # allow applying patches 648 postPatch = '' 649 substituteInPlace ext/h3/Makefile \ 650 --replace-fail 'cd src; cmake . -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DBUILD_SHARED_LIBS=true -DBUILD_FILTERS=OFF -DBUILD_BENCHMARKS=OFF -DENABLE_LINTING=OFF; make' ':' 651 substituteInPlace lib/h3/bindings/base.rb \ 652 --replace-fail '__dir__ + "/../../../ext/h3/src/lib"' '"${h3_3}/lib"' 653 ''; 654 postInstall = '' 655 rm -rf $out/${ruby.gemPath}/gems/h3-${attrs.version}/ext/h3/src 656 ''; 657 }; 658 659 hiredis-client = attrs: { 660 buildInputs = [ 661 openssl 662 ]; 663 }; 664 665 hpricot = attrs: { 666 dontBuild = false; 667 patches = [ 668 # Fix incompatible function pointer conversion errors with clang 16 669 ./hpricot-fix-incompatible-function-pointer-conversion.patch 670 ]; 671 env.NIX_CFLAGS_COMPILE = toString [ 672 "-Wno-error=incompatible-pointer-types" 673 "-Wno-error=int-conversion" 674 ]; 675 }; 676 677 iconv = attrs: { 678 buildFlags = lib.optionals stdenv.hostPlatform.isDarwin [ 679 "--with-iconv-dir=${lib.getLib libiconv}" 680 "--with-iconv-include=${lib.getDev libiconv}/include" 681 ]; 682 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; 683 }; 684 685 idn-ruby = attrs: { 686 buildInputs = [ libidn ]; 687 }; 688 689 # disable bundle install as it can't install anything in addition to what is 690 # specified in pkgs/applications/misc/jekyll/Gemfile anyway. Also do chmod_R 691 # to compensate for read-only files in site_template in nix store. 692 jekyll = attrs: { 693 postInstall = '' 694 installPath=$(cat $out/nix-support/gem-meta/install-path) 695 sed -i $installPath/lib/jekyll/commands/new.rb \ 696 -e 's@Exec.run("bundle", "install"@Exec.run("true"@' \ 697 -e 's@FileUtils.cp_r site_template + "/.", path@FileUtils.cp_r site_template + "/.", path; FileUtils.chmod_R "u+w", path@' 698 ''; 699 }; 700 701 execjs = attrs: { 702 propagatedBuildInputs = [ nodejs.libv8 ]; 703 }; 704 705 libxml-ruby = attrs: { 706 buildFlags = [ 707 "--with-xml2-lib=${libxml2.out}/lib" 708 "--with-xml2-include=${libxml2.dev}/include/libxml2" 709 ] 710 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 711 "--with-iconv-dir=${lib.getLib libiconv}" 712 "--with-opt-include=${lib.getDev libiconv}/include" 713 ]; 714 }; 715 716 mathematical = attrs: { 717 nativeBuildInputs = [ 718 ruby 719 cmake 720 bison 721 flex 722 pkg-config 723 python3 724 patchelf 725 ]; 726 727 buildInputs = [ 728 cairo 729 fribidi 730 gdk-pixbuf 731 glib 732 libxml2 733 pango 734 ]; 735 736 strictDeps = true; 737 738 # The ruby build script takes care of this 739 dontUseCmakeConfigure = true; 740 741 postInstall = '' 742 # Reduce output size by a lot, and remove some unnecessary references. 743 # The ext directory should only be required at build time, so 744 # can be deleted now. 745 rm -r $out/${ruby.gemPath}/gems/mathematical-${attrs.version}/ext \ 746 $out/${ruby.gemPath}/extensions/*/*/mathematical-${attrs.version}/gem_make.out 747 ''; 748 749 # For some reason 'mathematical.so' is missing cairo, glib, and 750 # lasem in its RPATH, add them explicitly here 751 postFixup = 752 lib.optionalString stdenv.hostPlatform.isLinux '' 753 soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so" 754 rpath="$(patchelf --print-rpath "$soPath")" 755 patchelf --set-rpath "${ 756 lib.makeLibraryPath [ 757 lasem 758 glib 759 cairo 760 ] 761 }:$rpath" "$soPath" 762 patchelf --replace-needed liblasem.so liblasem-0.4.so "$soPath" 763 '' 764 + lib.optionalString stdenv.hostPlatform.isDarwin '' 765 soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.bundle" 766 install_name_tool -add_rpath "${ 767 lib.makeLibraryPath [ 768 lasem 769 glib 770 cairo 771 ] 772 }/lib" "$soPath" 773 install_name_tool -change @rpath/liblasem.dylib "${lib.getLib lasem}/lib/liblasem-0.4.dylib" "$soPath" 774 ''; 775 }; 776 777 magic = attrs: { 778 buildInputs = [ file ]; 779 postInstall = '' 780 installPath=$(cat $out/nix-support/gem-meta/install-path) 781 sed -e 's@ENV\["MAGIC_LIB"\] ||@ENV\["MAGIC_LIB"\] || "${file}/lib/libmagic.so" ||@' -i $installPath/lib/magic/api.rb 782 ''; 783 }; 784 785 maxmind_geoip2 = attrs: { 786 buildFlags = [ 787 "--with-maxminddb-lib=${libmaxminddb}/lib" 788 "--with-maxminddb-include=${libmaxminddb}/include" 789 ]; 790 }; 791 792 metasploit-framework = attrs: { 793 preInstall = '' 794 export HOME=$TMPDIR 795 ''; 796 }; 797 798 mysql = attrs: { 799 buildInputs = [ 800 libmysqlclient 801 zlib 802 openssl 803 ]; 804 }; 805 806 mysql2 = attrs: { 807 buildInputs = [ 808 libmysqlclient 809 zlib 810 openssl 811 ]; 812 }; 813 814 ncursesw = attrs: { 815 buildInputs = [ ncurses ]; 816 buildFlags = [ 817 "--with-cflags=-I${ncurses.dev}/include" 818 "--with-ldflags=-L${ncurses.out}/lib" 819 ]; 820 }; 821 822 nokogiri = 823 attrs: 824 ( 825 { 826 buildFlags = [ 827 "--use-system-libraries" 828 "--with-zlib-lib=${zlib.out}/lib" 829 "--with-zlib-include=${zlib.dev}/include" 830 "--with-xml2-lib=${libxml2.out}/lib" 831 "--with-xml2-include=${libxml2.dev}/include/libxml2" 832 "--with-xslt-lib=${libxslt.out}/lib" 833 "--with-xslt-include=${libxslt.dev}/include" 834 "--with-exslt-lib=${libxslt.out}/lib" 835 "--with-exslt-include=${libxslt.dev}/include" 836 ] 837 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 838 "--with-iconv-dir=${libiconv}" 839 "--with-opt-include=${libiconv}/include" 840 ]; 841 } 842 // lib.optionalAttrs stdenv.hostPlatform.isDarwin { 843 buildInputs = [ libxml2 ]; 844 845 # libxml 2.12 upgrade requires these fixes 846 # https://github.com/sparklemotion/nokogiri/pull/3032 847 # which don't trivially apply to older versions 848 meta.broken = 849 (lib.versionOlder attrs.version "1.16.0") && (lib.versionAtLeast libxml2.version "2.12"); 850 } 851 ); 852 853 openssl = attrs: { 854 # https://github.com/ruby/openssl/issues/369 855 buildInputs = [ (if (lib.versionAtLeast attrs.version "3.0.0") then openssl else openssl_1_1) ]; 856 }; 857 858 opus-ruby = attrs: { 859 dontBuild = false; 860 postPatch = '' 861 substituteInPlace lib/opus-ruby.rb \ 862 --replace "ffi_lib 'opus'" \ 863 "ffi_lib '${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}'" 864 ''; 865 }; 866 867 ovirt-engine-sdk = attrs: { 868 buildInputs = [ 869 curl 870 libxml2 871 ]; 872 # https://github.com/oVirt/ovirt-engine-sdk-ruby/issues/13 873 env.NIX_CFLAGS_COMPILE = toString [ 874 "-Wno-error=implicit-function-declaration" 875 "-Wno-error=incompatible-pointer-types" 876 "-Wno-int-conversion" 877 ]; 878 dontBuild = false; 879 meta.broken = stdenv.hostPlatform.isDarwin; # At least until releasing https://github.com/oVirt/ovirt-engine-sdk-ruby/pull/17 880 }; 881 882 pango = attrs: { 883 nativeBuildInputs = [ 884 pkg-config 885 ] 886 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ]; 887 buildInputs = [ 888 libdatrie 889 libthai 890 fribidi 891 harfbuzz 892 libsysprof-capture 893 pcre2 894 libpthread-stubs 895 libxdmcp 896 ] 897 ++ lib.optionals stdenv.hostPlatform.isLinux [ 898 libselinux 899 libsepol 900 util-linux 901 ]; 902 propagatedBuildInputs = [ 903 gobject-introspection 904 wrapGAppsHook3 905 ]; 906 }; 907 908 patron = attrs: { 909 buildInputs = [ curl ]; 910 }; 911 912 pcaprub = attrs: { 913 buildInputs = [ libpcap ]; 914 }; 915 916 pg = attrs: { 917 # Force pkg-config lookup for libpq. 918 # See https://github.com/ged/ruby-pg/blob/6629dec6656f7ca27619e4675b45225d9e422112/ext/extconf.rb#L34-L55 919 # 920 # Note that setting --with-pg-config=${postgresql.pg_config}/bin/pg_config would add 921 # an unnecessary reference to the entire postgresql package. 922 buildFlags = [ "--with-pg-config=ignore" ]; 923 nativeBuildInputs = [ pkg-config ]; 924 buildInputs = [ libpq ]; 925 }; 926 927 rszr = attrs: { 928 buildInputs = [ 929 imlib2 930 imlib2.dev 931 ]; 932 buildFlags = [ "--without-imlib2-config" ]; 933 }; 934 935 psych = attrs: { 936 buildInputs = [ libyaml ]; 937 }; 938 939 puma = attrs: { 940 buildInputs = [ openssl ]; 941 }; 942 943 "pygments.rb" = attrs: { 944 buildInputs = [ python3 ]; 945 }; 946 947 rack = attrs: { 948 meta.mainProgram = "rackup"; 949 }; 950 951 railties = attrs: { 952 meta.mainProgram = "rails"; 953 }; 954 955 rainbow = attrs: { 956 buildInputs = [ rainbow_rake ]; 957 }; 958 959 rbczmq = 960 { ... }: 961 { 962 buildInputs = [ 963 zeromq 964 czmq 965 ]; 966 buildFlags = [ "--with-system-libs" ]; 967 }; 968 969 rbnacl = 970 spec: 971 if lib.versionOlder spec.version "6.0.0" then 972 { 973 postInstall = '' 974 sed -i $(cat $out/nix-support/gem-meta/install-path)/lib/rbnacl.rb -e "2a \ 975 RBNACL_LIBSODIUM_GEM_LIB_PATH = '${libsodium.out}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}' 976 " 977 ''; 978 } 979 else 980 { 981 dontBuild = false; 982 postPatch = '' 983 substituteInPlace lib/rbnacl/sodium.rb \ 984 --replace 'ffi_lib ["sodium"' \ 985 'ffi_lib ["${libsodium}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}"' 986 ''; 987 }; 988 989 re2 = attrs: { 990 buildInputs = [ re2 ]; 991 buildFlags = [ 992 "--enable-system-libraries" 993 ]; 994 }; 995 996 rest-client = attrs: { 997 meta.mainProgram = "restclient"; 998 }; 999 1000 rmagick = attrs: { 1001 nativeBuildInputs = [ pkg-config ]; 1002 buildInputs = [ 1003 imagemagick 1004 which 1005 ]; 1006 }; 1007 1008 rouge = attrs: { 1009 meta.mainProgram = "rougify"; 1010 }; 1011 1012 rpam2 = attrs: { 1013 buildInputs = [ linux-pam ]; 1014 }; 1015 1016 rspec-core = attrs: { 1017 meta.mainProgram = "rspec"; 1018 }; 1019 1020 ruby-libvirt = attrs: { 1021 nativeBuildInputs = [ pkg-config ]; 1022 buildInputs = [ libvirt ]; 1023 buildFlags = [ 1024 "--with-libvirt-include=${libvirt}/include" 1025 "--with-libvirt-lib=${libvirt}/lib" 1026 ]; 1027 }; 1028 1029 ruby-lxc = attrs: { 1030 buildInputs = [ lxc ]; 1031 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; 1032 }; 1033 1034 ruby-terminfo = attrs: { 1035 buildInputs = [ ncurses ]; 1036 buildFlags = [ 1037 "--with-cflags=-I${ncurses.dev}/include" 1038 "--with-ldflags=-L${ncurses.out}/lib" 1039 ]; 1040 dontBuild = false; 1041 postPatch = '' 1042 substituteInPlace extconf.rb --replace 'rubyio.h' 'ruby/io.h' 1043 substituteInPlace terminfo.c \ 1044 --replace 'rubyio.h' 'ruby/io.h' \ 1045 --replace 'rb_cData' 'rb_cObject' 1046 ''; 1047 }; 1048 1049 ruby-vips = attrs: { 1050 postInstall = '' 1051 cd "$(cat $out/nix-support/gem-meta/install-path)" 1052 1053 substituteInPlace lib/vips.rb \ 1054 --replace 'FFI.library_name("vips", 42)' '"${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}"' \ 1055 --replace 'FFI.library_name("glib-2.0", 0)' '"${glib.out}/lib/libglib-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' \ 1056 --replace 'FFI.library_name("gobject-2.0", 0)' '"${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' \ 1057 --replace 'library_name("vips", 42)' '"${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}"' \ 1058 --replace 'library_name("glib-2.0", 0)' '"${glib.out}/lib/libglib-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' \ 1059 --replace 'library_name("gobject-2.0", 0)' '"${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' 1060 ''; 1061 }; 1062 1063 rugged = attrs: { 1064 nativeBuildInputs = [ 1065 cmake 1066 pkg-config 1067 which 1068 ] 1069 ++ lib.optional stdenv.hostPlatform.isDarwin libiconv; 1070 buildInputs = [ 1071 openssl 1072 libssh2 1073 zlib 1074 ]; 1075 dontUseCmakeConfigure = true; 1076 buildFlags = [ "--with-ssh" ]; 1077 }; 1078 1079 sassc = attrs: { 1080 nativeBuildInputs = [ rake ]; 1081 dontBuild = false; 1082 SASS_LIBSASS_PATH = toString libsass; 1083 postPatch = '' 1084 substituteInPlace lib/sassc/native.rb \ 1085 --replace 'gem_root = spec.gem_dir' 'gem_root = File.join(__dir__, "../../")' 1086 ''; 1087 }; 1088 1089 sass-embedded = attrs: { 1090 # Patch the Rakefile to use our dart-sass and not try to fetch anything. 1091 dontBuild = false; 1092 postPatch = '' 1093 substituteInPlace ext/sass/Rakefile \ 1094 --replace \'dart-sass/sass\' \'${dart-sass}/bin/sass\' \ 1095 --replace ' => %w[dart-sass]' "" 1096 ''; 1097 }; 1098 1099 scrypt = 1100 attrs: 1101 lib.optionalAttrs stdenv.hostPlatform.isDarwin { 1102 dontBuild = false; 1103 postPatch = '' 1104 sed -i -e "s/-arch i386//" Rakefile ext/scrypt/Rakefile 1105 ''; 1106 }; 1107 1108 semian = attrs: { 1109 buildInputs = [ openssl ]; 1110 }; 1111 1112 sequel_pg = attrs: { 1113 buildInputs = [ libpq ]; 1114 }; 1115 1116 snappy = attrs: { 1117 buildInputs = [ args.snappy ]; 1118 }; 1119 1120 sqlite3 = 1121 attrs: 1122 if lib.versionAtLeast attrs.version "1.5.0" then 1123 { 1124 nativeBuildInputs = [ pkg-config ]; 1125 buildInputs = [ sqlite ]; 1126 buildFlags = [ 1127 "--enable-system-libraries" 1128 ]; 1129 } 1130 else 1131 { 1132 buildFlags = [ 1133 "--with-sqlite3-include=${sqlite.dev}/include" 1134 "--with-sqlite3-lib=${sqlite.out}/lib" 1135 ]; 1136 env.NIX_CFLAGS_COMPILE = toString [ 1137 "-Wno-error=incompatible-pointer-types" 1138 "-Wno-error=int-conversion" 1139 ]; 1140 }; 1141 1142 rb-readline = attrs: { 1143 dontBuild = false; 1144 postPatch = '' 1145 substituteInPlace lib/rbreadline.rb \ 1146 --replace 'infocmp' '${ncurses}/bin/infocmp' 1147 ''; 1148 }; 1149 1150 taglib-ruby = attrs: { 1151 buildInputs = [ taglib ]; 1152 }; 1153 1154 timfel-krb5-auth = attrs: { 1155 buildInputs = [ libkrb5 ]; 1156 }; 1157 1158 tiny_tds = attrs: { 1159 nativeBuildInputs = [ 1160 pkg-config 1161 openssl 1162 ]; 1163 buildInputs = [ freetds ]; 1164 }; 1165 1166 treetop = attrs: { 1167 meta.mainProgram = "tt"; 1168 }; 1169 1170 typhoeus = attrs: { 1171 buildInputs = [ curl ]; 1172 }; 1173 1174 tzinfo = 1175 attrs: 1176 lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") { 1177 dontBuild = false; 1178 postPatch = 1179 let 1180 path = 1181 if lib.versionAtLeast attrs.version "2.0" then 1182 "lib/tzinfo/data_sources/zoneinfo_data_source.rb" 1183 else 1184 "lib/tzinfo/zoneinfo_data_source.rb"; 1185 in 1186 '' 1187 substituteInPlace ${path} \ 1188 --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" 1189 ''; 1190 }; 1191 1192 uuid4r = attrs: { 1193 buildInputs = [ 1194 which 1195 libossp_uuid 1196 ]; 1197 }; 1198 1199 whois = attrs: { 1200 meta.mainProgram = "whoisrb"; 1201 }; 1202 1203 xapian-ruby = attrs: { 1204 # use the system xapian 1205 dontBuild = false; 1206 nativeBuildInputs = [ 1207 rake 1208 pkg-config 1209 bundler 1210 ]; 1211 buildInputs = [ 1212 xapian 1213 zlib 1214 ]; 1215 postPatch = '' 1216 cp ${./xapian-Rakefile} Rakefile 1217 ''; 1218 preInstall = '' 1219 export XAPIAN_CONFIG=${xapian}/bin/xapian-config 1220 ''; 1221 }; 1222 1223 zlib = attrs: { 1224 buildInputs = [ zlib ]; 1225 }; 1226 1227 zookeeper = attrs: { 1228 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ cctools ]; 1229 }; 1230}