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