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 seperates "what to build" (the exact gem versions) from "how to build"
18# (to make gems behave if necessary).
19
20{ lib, fetchurl, writeScript, ruby, libkrb5, libxml2, libxslt, python2, stdenv, which
21, libiconv, postgresql, v8, clang, sqlite, zlib, imagemagick, lasem
22, pkg-config , ncurses, xapian, gpgme, util-linux, tzdata, icu, libffi
23, cmake, libssh2, openssl, openssl_1_1, libmysqlclient, git, perl, pcre, pcre2, gecode_3, curl
24, msgpack, libsodium, snappy, libossp_uuid, lxc, libpcap, xorg, gtk2, buildRubyGem
25, cairo, re2, rake, gobject-introspection, gdk-pixbuf, zeromq, czmq, graphicsmagick, libcxx
26, file, libvirt, glib, vips, taglib, libopus, linux-pam, libidn, protobuf, fribidi, harfbuzz
27, bison, flex, pango, python3, patchelf, binutils, freetds, wrapGAppsHook, atk
28, bundler, libsass, libexif, libselinux, libsepol, shared-mime-info, libthai, libdatrie
29, CoreServices, DarwinTools, cctools, libtool, discount, exiv2, libmaxminddb
30}@args:
31
32let
33 rainbow_rake = buildRubyGem {
34 pname = "rake";
35 gemName = "rake";
36 source.sha256 = "01j8fc9bqjnrsxbppncai05h43315vmz9fwg28qdsgcjw9ck1d7n";
37 type = "gem";
38 version = "12.0.0";
39 };
40in
41
42{
43 ZenTest = attrs: {
44 meta.mainProgram = "zentest";
45 };
46
47 atk = attrs: {
48 dependencies = attrs.dependencies ++ [ "gobject-introspection" ];
49 nativeBuildInputs = [ rake bundler pkg-config ]
50 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
51 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook atk ];
52 };
53
54 bundler = attrs:
55 let
56 templates = "${attrs.ruby.gemPath}/gems/${attrs.gemName}-${attrs.version}/lib/bundler/templates/";
57 in {
58 # patching shebangs would fail on the templates/Executable file, so we
59 # temporarily remove the executable flag.
60 preFixup = "chmod -x $out/${templates}/Executable";
61 postFixup = ''
62 chmod +x $out/${templates}/Executable
63
64 # Allows to load another bundler version
65 sed -i -e "s/activate_bin_path/bin_path/g" $out/bin/bundle
66 '';
67 };
68
69 cairo = attrs: {
70 nativeBuildInputs = [ pkg-config ]
71 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
72 buildInputs = [ gtk2 pcre2 xorg.libpthreadstubs xorg.libXdmcp];
73 };
74
75 cairo-gobject = attrs: {
76 nativeBuildInputs = [ pkg-config ]
77 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
78 buildInputs = [ cairo pcre2 xorg.libpthreadstubs xorg.libXdmcp ];
79 };
80
81 charlock_holmes = attrs: {
82 buildInputs = [ which icu zlib ];
83 };
84
85 cld3 = attrs: {
86 nativeBuildInputs = [ pkg-config ];
87 buildInputs = [ protobuf ];
88 };
89
90 cocoapods-acknowledgements = attrs: {
91 dependencies = attrs.dependencies ++ [ "cocoapods" ];
92 };
93
94 cocoapods-deploy = attrs: {
95 dependencies = [ "cocoapods" ];
96 };
97
98 cocoapods-disable-podfile-validations = attrs: {
99 dependencies = [ "cocoapods" ];
100 };
101
102 cocoapods-generate = attrs: {
103 dependencies = attrs.dependencies ++ [ "cocoapods" ];
104 };
105
106 cocoapods-git_url_rewriter = attrs: {
107 dependencies = [ "cocoapods" ];
108 };
109
110 cocoapods-keys = attrs: {
111 dependencies = attrs.dependencies ++ [ "cocoapods" ];
112 };
113
114 cocoapods-open = attrs: {
115 dependencies = [ "cocoapods" ];
116 };
117
118 cocoapods-try-release-fix = attrs: {
119 dependencies = [ "cocoapods" ];
120 };
121
122 curb = attrs: {
123 buildInputs = [ curl ];
124 };
125
126 curses = attrs: {
127 buildInputs = [ ncurses ];
128 };
129
130 dep-selector-libgecode = attrs: {
131 USE_SYSTEM_GECODE = true;
132 postInstall = ''
133 installPath=$(cat $out/nix-support/gem-meta/install-path)
134 sed -i $installPath/lib/dep-selector-libgecode.rb -e 's@VENDORED_GECODE_DIR =.*@VENDORED_GECODE_DIR = "${gecode_3}"@'
135 '';
136 };
137
138 digest-sha3 = attrs: {
139 hardeningDisable = [ "format" ];
140 };
141
142 rdiscount = attrs: {
143 # Use discount from nixpkgs instead of vendored version
144 dontBuild = false;
145 buildInputs = [ discount ];
146 patches = [
147 # Adapted from Debian:
148 # https://sources.debian.org/data/main/r/ruby-rdiscount/2.1.8-1/debian/patches/01_use-system-libmarkdown.patch
149 ./rdiscount-use-nixpkgs-libmarkdown.patch
150 ];
151 };
152
153 ethon = attrs: {
154 dontBuild = false;
155 postPatch = ''
156 substituteInPlace lib/ethon/curls/settings.rb \
157 --replace "libcurl" "${curl.out}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary}"
158 '';
159 };
160
161 exiv2 = attrs: {
162 buildFlags = [ "--with-exiv2-lib=${exiv2}/lib" "--with-exiv2-include=${exiv2.dev}/include" ];
163 };
164
165 fog-dnsimple = attrs:
166 lib.optionalAttrs (lib.versionOlder attrs.version "1.0.1") {
167 postInstall = ''
168 cd $(cat $out/nix-support/gem-meta/install-path)
169 rm {$out/bin,bin,../../bin}/{setup,console}
170 '';
171 };
172
173 redis-rack = attrs: {
174 dontBuild = false;
175 preBuild = ''
176 exec 3>&1
177 output="$(gem build $gemspec | tee >(cat - >&3))"
178 exec 3>&-
179 sed -i 's!"rake".freeze!!' $gemspec
180 '';
181 };
182
183 ffi-rzmq-core = attrs: {
184 postInstall = ''
185 installPath=$(cat $out/nix-support/gem-meta/install-path)
186 sed -i $installPath/lib/ffi-rzmq-core/libzmq.rb -e 's@inside_gem =.*@inside_gem = "${zeromq}/lib"@'
187 '';
188 };
189
190 mimemagic = attrs: {
191 FREEDESKTOP_MIME_TYPES_PATH = "${shared-mime-info}/share/mime/packages/freedesktop.org.xml";
192 };
193
194 mini_magick = attrs: {
195 postInstall = ''
196 installPath=$(cat $out/nix-support/gem-meta/install-path)
197 echo -e "\nENV['PATH'] += ':${graphicsmagick}/bin'\n" >> $installPath/lib/mini_magick/configuration.rb
198 '';
199 };
200
201 do_sqlite3 = attrs: {
202 buildInputs = [ sqlite ];
203 };
204
205 eventmachine = attrs: {
206 buildInputs = [ openssl ];
207 };
208
209 exif = attrs: {
210 buildFlags = [ "--with-exif-dir=${libexif}" ];
211 buildInputs = [ libexif ];
212 };
213
214 ffi = attrs: {
215 nativeBuildInputs = [ pkg-config ];
216 buildInputs = [ libffi ];
217 };
218
219 gdk_pixbuf2 = attrs: {
220 nativeBuildInputs = [ pkg-config bundler rake ]
221 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
222 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook gdk-pixbuf ];
223 };
224
225 gpgme = attrs: {
226 buildInputs = [ gpgme ];
227 buildFlags = [ "--use-system-libraries" ];
228 };
229
230 gio2 = attrs: {
231 nativeBuildInputs = [ pkg-config ]
232 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
233 buildInputs = [ gtk2 pcre pcre2 gobject-introspection ] ++ lib.optionals stdenv.isLinux [ util-linux libselinux libsepol ];
234 };
235
236 gitlab-markup = attrs: { meta.priority = 1; };
237
238 gitlab-pg_query = attrs: lib.optionalAttrs (attrs.version == "1.3.1") {
239 dontBuild = false;
240 postPatch = ''
241 sed -i "s;'https://codeload.github.com.*';'${fetchurl {
242 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.3";
243 sha256 = "0jfij8apzxsdabl70j42xgd5f3ka1gdcrk764nccp66164gpcchk";
244 }}';" ext/pg_query/extconf.rb
245 '';
246 };
247
248 parser = attrs: {
249 meta.mainProgram = "ruby-parse";
250 };
251
252 pg_query = attrs: lib.optionalAttrs (attrs.version == "2.0.2") {
253 dontBuild = false;
254 postPatch = ''
255 sed -i "s;'https://codeload.github.com.*';'${fetchurl {
256 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/13-2.0.2";
257 sha256 = "0ms2s6hmy8qyzv4g1hj4i2p5fws1v8lrj73b2knwbp2ipd45yj7y";
258 }}';" ext/pg_query/extconf.rb
259 '';
260 } // lib.optionalAttrs (attrs.version == "1.3.0") {
261 # Needed for gitlab
262 dontBuild = false;
263 postPatch = ''
264 sed -i "s;'https://codeload.github.com.*';'${fetchurl {
265 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.4";
266 sha256 = "0f0kshhai0pnkqj0w4kgz3fssnvwidllc31n1fysxjjzdqlr1k48";
267 }}';" ext/pg_query/extconf.rb
268 '';
269 };
270
271 prettier = attrs: {
272 meta.mainProgram = "rbprettier";
273 };
274
275 glib2 = attrs: {
276 nativeBuildInputs = [ pkg-config ]
277 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
278 buildInputs = [ gtk2 pcre2 ];
279 };
280
281 gtk2 = attrs: {
282 nativeBuildInputs = [
283 binutils pkg-config
284 ] ++ lib.optionals stdenv.isLinux [
285 util-linux libselinux libsepol
286 ] ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
287 propagatedBuildInputs = [
288 atk
289 gdk-pixbuf
290 fribidi
291 gobject-introspection
292 gtk2
293 harfbuzz
294 libdatrie
295 libthai
296 pcre pcre2
297 xorg.libpthreadstubs
298 xorg.libXdmcp
299 ];
300 dontStrip = stdenv.isDarwin;
301 };
302
303 gobject-introspection = attrs: {
304 nativeBuildInputs = [ pkg-config pcre2 ]
305 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
306 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook glib ];
307 };
308
309 gollum = attrs: {
310 dontBuild = false;
311 postPatch = ''
312 substituteInPlace bin/gollum \
313 --replace "/usr/bin/env -S ruby" "${ruby}/bin/ruby"
314 '';
315 };
316
317 grpc = attrs: {
318 nativeBuildInputs = [ pkg-config ] ++ lib.optional stdenv.isDarwin cctools;
319 buildInputs = [ openssl ];
320 hardeningDisable = [ "format" ];
321 NIX_CFLAGS_COMPILE = toString [
322 "-Wno-error=stringop-overflow"
323 "-Wno-error=implicit-fallthrough"
324 "-Wno-error=sizeof-pointer-memaccess"
325 "-Wno-error=cast-function-type"
326 "-Wno-error=class-memaccess"
327 "-Wno-error=ignored-qualifiers"
328 "-Wno-error=tautological-compare"
329 "-Wno-error=stringop-truncation"
330 ];
331 dontBuild = false;
332 postPatch = ''
333 substituteInPlace Makefile \
334 --replace '-Wno-invalid-source-encoding' ""
335 '' + lib.optionalString stdenv.isDarwin ''
336 # For < v1.48.0
337 substituteInPlace src/ruby/ext/grpc/extconf.rb \
338 --replace "ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/" ""
339 # For >= v1.48.0
340 substituteInPlace src/ruby/ext/grpc/extconf.rb \
341 --replace 'apple_toolchain = ' 'apple_toolchain = false && '
342 '';
343 };
344
345 hitimes = attrs: {
346 buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
347 };
348
349 iconv = attrs: {
350 buildFlags = lib.optional stdenv.isDarwin "--with-iconv-dir=${libiconv}";
351 };
352
353 idn-ruby = attrs: {
354 buildInputs = [ libidn ];
355 };
356
357 # disable bundle install as it can't install anything in addition to what is
358 # specified in pkgs/applications/misc/jekyll/Gemfile anyway. Also do chmod_R
359 # to compensate for read-only files in site_template in nix store.
360 jekyll = attrs: {
361 postInstall = ''
362 installPath=$(cat $out/nix-support/gem-meta/install-path)
363 sed -i $installPath/lib/jekyll/commands/new.rb \
364 -e 's@Exec.run("bundle", "install"@Exec.run("true"@' \
365 -e 's@FileUtils.cp_r site_template + "/.", path@FileUtils.cp_r site_template + "/.", path; FileUtils.chmod_R "u+w", path@'
366 '';
367 };
368
369 # note that you need version >= v3.16.14.8,
370 # otherwise the gem will fail to link to the libv8 binary.
371 # see: https://github.com/cowboyd/libv8/pull/161
372 libv8 = attrs: {
373 buildInputs = [ which v8 python2 ];
374 buildFlags = [ "--with-system-v8=true" ];
375 dontBuild = false;
376 # The gem includes broken symlinks which are ignored during unpacking, but
377 # then fail during build. Since the content is missing anyway, touching the
378 # files is enough to unblock the build.
379 preBuild = ''
380 touch vendor/depot_tools/cbuildbot vendor/depot_tools/chrome_set_ver vendor/depot_tools/cros_sdk
381 '';
382 postPatch = ''
383 substituteInPlace ext/libv8/extconf.rb \
384 --replace "location = Libv8::Location::Vendor.new" \
385 "location = Libv8::Location::System.new"
386 '';
387 };
388
389 execjs = attrs: {
390 propagatedBuildInputs = [ v8 ];
391 };
392
393 libxml-ruby = attrs: {
394 buildFlags = [
395 "--with-xml2-lib=${libxml2.out}/lib"
396 "--with-xml2-include=${libxml2.dev}/include/libxml2"
397 ];
398 };
399
400 mathematical = attrs: {
401 nativeBuildInputs = [
402 ruby
403 cmake
404 bison
405 flex
406 pkg-config
407 python3
408 patchelf
409 ];
410
411 buildInputs = [
412 cairo
413 fribidi
414 gdk-pixbuf
415 glib
416 libxml2
417 pango
418 ];
419
420 strictDeps = true;
421
422 # The ruby build script takes care of this
423 dontUseCmakeConfigure = true;
424
425 postInstall = ''
426 # Reduce output size by a lot, and remove some unnecessary references.
427 # The ext directory should only be required at build time, so
428 # can be deleted now.
429 rm -r $out/${ruby.gemPath}/gems/mathematical-${attrs.version}/ext \
430 $out/${ruby.gemPath}/extensions/*/*/mathematical-${attrs.version}/gem_make.out
431 '';
432
433 # For some reason 'mathematical.so' is missing cairo, glib, and
434 # lasem in its RPATH, add them explicitly here
435 postFixup = lib.optionalString stdenv.isLinux ''
436 soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
437 rpath="$(patchelf --print-rpath "$soPath")"
438 patchelf --set-rpath "${lib.makeLibraryPath [ lasem glib cairo ]}:$rpath" "$soPath"
439 patchelf --replace-needed liblasem.so liblasem-0.4.so "$soPath"
440 '';
441 };
442
443 magic = attrs: {
444 buildInputs = [ file ];
445 postInstall = ''
446 installPath=$(cat $out/nix-support/gem-meta/install-path)
447 sed -e 's@ENV\["MAGIC_LIB"\] ||@ENV\["MAGIC_LIB"\] || "${file}/lib/libmagic.so" ||@' -i $installPath/lib/magic/api.rb
448 '';
449 };
450
451 maxmind_geoip2 = attrs: {
452 buildFlags = [ "--with-maxminddb-lib=${libmaxminddb}/lib" "--with-maxminddb-include=${libmaxminddb}/include" ];
453 };
454
455 metasploit-framework = attrs: {
456 preInstall = ''
457 export HOME=$TMPDIR
458 '';
459 };
460
461 msgpack = attrs: {
462 buildInputs = [ msgpack ];
463 };
464
465 mysql = attrs: {
466 buildInputs = [ libmysqlclient zlib openssl ];
467 };
468
469 mysql2 = attrs: {
470 buildInputs = [ libmysqlclient zlib openssl ];
471 };
472
473 ncursesw = attrs: {
474 buildInputs = [ ncurses ];
475 buildFlags = [
476 "--with-cflags=-I${ncurses.dev}/include"
477 "--with-ldflags=-L${ncurses.out}/lib"
478 ];
479 };
480
481 nokogiri = attrs: {
482 buildFlags = [
483 "--use-system-libraries"
484 "--with-zlib-lib=${zlib.out}/lib"
485 "--with-zlib-include=${zlib.dev}/include"
486 "--with-xml2-lib=${libxml2.out}/lib"
487 "--with-xml2-include=${libxml2.dev}/include/libxml2"
488 "--with-xslt-lib=${libxslt.out}/lib"
489 "--with-xslt-include=${libxslt.dev}/include"
490 "--with-exslt-lib=${libxslt.out}/lib"
491 "--with-exslt-include=${libxslt.dev}/include"
492 ] ++ lib.optionals stdenv.isDarwin [
493 "--with-iconv-dir=${libiconv}"
494 "--with-opt-include=${libiconv}/include"
495 ];
496 };
497
498 openssl = attrs: {
499 # https://github.com/ruby/openssl/issues/369
500 buildInputs = [ openssl_1_1 ];
501 };
502
503 opus-ruby = attrs: {
504 dontBuild = false;
505 postPatch = ''
506 substituteInPlace lib/opus-ruby.rb \
507 --replace "ffi_lib 'opus'" \
508 "ffi_lib '${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}'"
509 '';
510 };
511
512 ovirt-engine-sdk = attrs: {
513 buildInputs = [ curl libxml2 ];
514 };
515
516 pango = attrs: {
517 nativeBuildInputs = [
518 pkg-config
519 fribidi
520 harfbuzz
521 pcre pcre2
522 xorg.libpthreadstubs
523 xorg.libXdmcp
524 ] ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
525 buildInputs = [ libdatrie libthai ]
526 ++ lib.optionals stdenv.isLinux [ libselinux libsepol util-linux ];
527 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook gtk2 ];
528 };
529
530 patron = attrs: {
531 buildInputs = [ curl ];
532 };
533
534 pcaprub = attrs: {
535 buildInputs = [ libpcap ];
536 };
537
538 pg = attrs: {
539 buildFlags = [
540 "--with-pg-config=${postgresql}/bin/pg_config"
541 ];
542 };
543
544 puma = attrs: {
545 buildInputs = [ openssl ];
546 };
547
548 "pygments.rb" = attrs: {
549 buildInputs = [ python3 ];
550 };
551
552 rack = attrs: {
553 meta.mainProgram = "rackup";
554 };
555
556 railties = attrs: {
557 meta.mainProgram = "rails";
558 };
559
560 rainbow = attrs: {
561 buildInputs = [ rainbow_rake ];
562 };
563
564 rbczmq = { ... }: {
565 buildInputs = [ zeromq czmq ];
566 buildFlags = [ "--with-system-libs" ];
567 };
568
569 rbnacl = spec:
570 if lib.versionOlder spec.version "6.0.0" then {
571 postInstall = ''
572 sed -i $(cat $out/nix-support/gem-meta/install-path)/lib/rbnacl.rb -e "2a \
573 RBNACL_LIBSODIUM_GEM_LIB_PATH = '${libsodium.out}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}'
574 "
575 '';
576 } else {
577 dontBuild = false;
578 postPatch = ''
579 substituteInPlace lib/rbnacl/sodium.rb \
580 --replace 'ffi_lib ["sodium"' \
581 'ffi_lib ["${libsodium}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}"'
582 '';
583 };
584
585 re2 = attrs: {
586 buildInputs = [ re2 ];
587 };
588
589 rest-client = attrs: {
590 meta.mainProgram = "restclient";
591 };
592
593 rmagick = attrs: {
594 nativeBuildInputs = [ pkg-config ];
595 buildInputs = [ imagemagick which ];
596 };
597
598 rouge = attrs: {
599 meta.mainProgram = "rougify";
600 };
601
602 rpam2 = attrs: {
603 buildInputs = [ linux-pam ];
604 };
605
606 rspec-core = attrs: {
607 meta.mainProgram = "rspec";
608 };
609
610 ruby-libvirt = attrs: {
611 nativeBuildInputs = [ pkg-config ];
612 buildInputs = [ libvirt ];
613 buildFlags = [
614 "--with-libvirt-include=${libvirt}/include"
615 "--with-libvirt-lib=${libvirt}/lib"
616 ];
617 };
618
619 ruby-lxc = attrs: {
620 buildInputs = [ lxc ];
621 };
622
623 ruby-terminfo = attrs: {
624 buildInputs = [ ncurses ];
625 buildFlags = [
626 "--with-cflags=-I${ncurses.dev}/include"
627 "--with-ldflags=-L${ncurses.out}/lib"
628 ];
629 };
630
631 ruby-vips = attrs: {
632 postInstall = ''
633 cd "$(cat $out/nix-support/gem-meta/install-path)"
634
635 substituteInPlace lib/vips.rb \
636 --replace 'library_name("vips", 42)' '"${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}"' \
637 --replace 'library_name("glib-2.0", 0)' '"${glib.out}/lib/libglib-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' \
638 --replace 'library_name("gobject-2.0", 0)' '"${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"'
639 '';
640 };
641
642 rugged = attrs: {
643 nativeBuildInputs = [ cmake pkg-config which ] ++ lib.optional stdenv.isDarwin libiconv;
644 buildInputs = [ openssl libssh2 zlib ];
645 dontUseCmakeConfigure = true;
646 };
647
648 sassc = attrs: {
649 nativeBuildInputs = [ rake ];
650 dontBuild = false;
651 SASS_LIBSASS_PATH = toString libsass;
652 postPatch = ''
653 substituteInPlace lib/sassc/native.rb \
654 --replace 'gem_root = spec.gem_dir' 'gem_root = File.join(__dir__, "../../")'
655 '';
656 } // (lib.optionalAttrs stdenv.isDarwin {
657 # https://github.com/NixOS/nixpkgs/issues/19098
658 buildFlags = [ "--disable-lto" ];
659 });
660
661 scrypt = attrs: lib.optionalAttrs stdenv.isDarwin {
662 dontBuild = false;
663 postPatch = ''
664 sed -i -e "s/-arch i386//" Rakefile ext/scrypt/Rakefile
665 '';
666 };
667
668 semian = attrs: {
669 buildInputs = [ openssl ];
670 };
671
672 sequel_pg = attrs: {
673 buildInputs = [ postgresql ];
674 };
675
676 snappy = attrs: {
677 buildInputs = [ args.snappy ];
678 };
679
680 sqlite3 = attrs: if lib.versionAtLeast attrs.version "1.5.0"
681 then {
682 nativeBuildInputs = [ pkg-config ];
683 buildInputs = [ sqlite ];
684 buildFlags = [
685 "--enable-system-libraries"
686 ];
687 }
688 else {
689 buildFlags = [
690 "--with-sqlite3-include=${sqlite.dev}/include"
691 "--with-sqlite3-lib=${sqlite.out}/lib"
692 ];
693 };
694
695 rb-readline = attrs: {
696 dontBuild = false;
697 postPatch = ''
698 substituteInPlace lib/rbreadline.rb \
699 --replace 'infocmp' '${ncurses}/bin/infocmp'
700 '';
701 };
702
703 taglib-ruby = attrs: {
704 buildInputs = [ taglib ];
705 };
706
707 timfel-krb5-auth = attrs: {
708 buildInputs = [ libkrb5 ];
709 };
710
711 tiny_tds = attrs: {
712 nativeBuildInputs = [ pkg-config openssl ];
713 buildInputs = [ freetds ];
714 };
715
716 treetop = attrs: {
717 meta.mainProgram = "tt";
718 };
719
720 typhoeus = attrs: {
721 buildInputs = [ curl ];
722 };
723
724 tzinfo = attrs: lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") {
725 dontBuild = false;
726 postPatch =
727 let
728 path = if lib.versionAtLeast attrs.version "2.0"
729 then "lib/tzinfo/data_sources/zoneinfo_data_source.rb"
730 else "lib/tzinfo/zoneinfo_data_source.rb";
731 in
732 ''
733 substituteInPlace ${path} \
734 --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
735 '';
736 };
737
738 uuid4r = attrs: {
739 buildInputs = [ which libossp_uuid ];
740 };
741
742 whois = attrs: {
743 meta.mainProgram = "whoisrb";
744 };
745
746 xapian-ruby = attrs: {
747 # use the system xapian
748 dontBuild = false;
749 nativeBuildInputs = [ rake pkg-config bundler ];
750 buildInputs = [ xapian zlib ];
751 postPatch = ''
752 cp ${./xapian-Rakefile} Rakefile
753 '';
754 preInstall = ''
755 export XAPIAN_CONFIG=${xapian}/bin/xapian-config
756 '';
757 };
758
759 zlib = attrs: {
760 buildInputs = [ zlib ];
761 };
762
763 zookeeper = attrs: {
764 buildInputs = lib.optionals stdenv.isDarwin [ cctools ];
765 };
766}