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