nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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-slim,
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-slim.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 glib2 = attrs: {
481 nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
482 buildInputs = [
483 glib
484 libsysprof-capture
485 pcre2
486 ];
487 };
488
489 gtk3 = attrs: {
490 nativeBuildInputs = [
491 binutils
492 pkg-config
493 ]
494 ++ lib.optionals stdenv.hostPlatform.isLinux [
495 util-linux
496 libselinux
497 libsepol
498 ]
499 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
500 propagatedBuildInputs = [
501 atk
502 gdk-pixbuf
503 fribidi
504 gobject-introspection
505 gtk3
506 libdeflate
507 xz
508 libwebp
509 zstd
510 cairo
511 harfbuzz
512 lerc
513 libdatrie
514 libsysprof-capture
515 libthai
516 pcre2
517 libpthread-stubs
518 libxdmcp
519 libxtst
520 libxkbcommon
521 libepoxy
522 ];
523 dontStrip = stdenv.hostPlatform.isDarwin;
524 };
525
526 gobject-introspection = attrs: {
527 nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
528 propagatedBuildInputs = [
529 gobject-introspection
530 wrapGAppsHook3
531 glib
532 pcre2
533 libsysprof-capture
534 ];
535 };
536
537 gollum = attrs: {
538 dontBuild = false;
539 postPatch = ''
540 substituteInPlace bin/gollum \
541 --replace "/usr/bin/env -S ruby" "${ruby}/bin/ruby"
542 '';
543 };
544
545 google-protobuf =
546 attrs:
547 lib.optionalAttrs (lib.versionAtLeast attrs.version "3.25.0") {
548 # Fails on 3.25.0 with:
549 # convert.c:312:32: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
550 hardeningDisable = [ "format" ];
551 };
552
553 grpc = attrs: {
554 nativeBuildInputs = [
555 pkg-config
556 ]
557 ++ lib.optional stdenv.hostPlatform.isDarwin cctools
558 ++ lib.optional (
559 lib.versionAtLeast attrs.version "1.53.0"
560 && stdenv.hostPlatform.isDarwin
561 && stdenv.hostPlatform.isAarch64
562 ) autoSignDarwinBinariesHook;
563 buildInputs = [ openssl ];
564 hardeningDisable = [ "format" ];
565 env = lib.optionalAttrs (lib.versionOlder attrs.version "1.68.1") {
566 NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
567 };
568 patches = lib.optionals (lib.versionOlder attrs.version "1.65.0") [
569 (fetchpatch {
570 name = "gcc-14-fixes.patch";
571 url = "https://boringssl.googlesource.com/boringssl/+/c70190368c7040c37c1d655f0690bcde2b109a0d%5E%21/?format=TEXT";
572 decode = "base64 -d";
573 stripLen = 1;
574 extraPrefix = "third_party/boringssl-with-bazel/src/";
575 hash = "sha256-1QyQm5s55op268r72dfExNGV+UyV5Ty6boHa9DQq40U=";
576 })
577 ];
578 dontBuild = false;
579 postPatch = ''
580 substituteInPlace Makefile \
581 --replace '-Wno-invalid-source-encoding' ""
582 ''
583 + lib.optionalString (lib.versionOlder attrs.version "1.53.0" && stdenv.hostPlatform.isDarwin) ''
584 # For < v1.48.0
585 substituteInPlace src/ruby/ext/grpc/extconf.rb \
586 --replace "ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/" ""
587 # For >= v1.48.0
588 substituteInPlace src/ruby/ext/grpc/extconf.rb \
589 --replace 'apple_toolchain = ' 'apple_toolchain = false && '
590 '';
591 };
592
593 h3 = attrs: {
594 # This gem attempts to build h3 using cmake, but fails because that is not in the path
595 # Use h3 from nixpkgs instead, and reduce closure size by deleting the h3 source code
596 dontBuild = false; # allow applying patches
597 postPatch = ''
598 substituteInPlace ext/h3/Makefile \
599 --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' ':'
600 substituteInPlace lib/h3/bindings/base.rb \
601 --replace-fail '__dir__ + "/../../../ext/h3/src/lib"' '"${h3_3}/lib"'
602 '';
603 postInstall = ''
604 rm -rf $out/${ruby.gemPath}/gems/h3-${attrs.version}/ext/h3/src
605 '';
606 };
607
608 hiredis-client = attrs: {
609 buildInputs = [
610 openssl
611 ];
612 };
613
614 hpricot = attrs: {
615 dontBuild = false;
616 patches = [
617 # Fix incompatible function pointer conversion errors with clang 16
618 ./hpricot-fix-incompatible-function-pointer-conversion.patch
619 ];
620 env.NIX_CFLAGS_COMPILE = toString [
621 "-Wno-error=incompatible-pointer-types"
622 "-Wno-error=int-conversion"
623 ];
624 };
625
626 iconv = attrs: {
627 buildFlags = lib.optionals stdenv.hostPlatform.isDarwin [
628 "--with-iconv-dir=${lib.getLib libiconv}"
629 "--with-iconv-include=${lib.getDev libiconv}/include"
630 ];
631 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
632 };
633
634 idn-ruby = attrs: {
635 buildInputs = [ libidn ];
636 };
637
638 # disable bundle install as it can't install anything in addition to what is
639 # specified in pkgs/applications/misc/jekyll/Gemfile anyway. Also do chmod_R
640 # to compensate for read-only files in site_template in nix store.
641 jekyll = attrs: {
642 postInstall = ''
643 installPath=$(cat $out/nix-support/gem-meta/install-path)
644 sed -i $installPath/lib/jekyll/commands/new.rb \
645 -e 's@Exec.run("bundle", "install"@Exec.run("true"@' \
646 -e 's@FileUtils.cp_r site_template + "/.", path@FileUtils.cp_r site_template + "/.", path; FileUtils.chmod_R "u+w", path@'
647 '';
648 };
649
650 execjs = attrs: {
651 propagatedBuildInputs = [ nodejs-slim.libv8 ];
652 };
653
654 libxml-ruby = attrs: {
655 buildFlags = [
656 "--with-xml2-lib=${libxml2.out}/lib"
657 "--with-xml2-include=${libxml2.dev}/include/libxml2"
658 ]
659 ++ lib.optionals stdenv.hostPlatform.isDarwin [
660 "--with-iconv-dir=${lib.getLib libiconv}"
661 "--with-opt-include=${lib.getDev libiconv}/include"
662 ];
663 };
664
665 mathematical = attrs: {
666 nativeBuildInputs = [
667 ruby
668 cmake
669 bison
670 flex
671 pkg-config
672 python3
673 patchelf
674 ];
675
676 buildInputs = [
677 cairo
678 fribidi
679 gdk-pixbuf
680 glib
681 libxml2
682 pango
683 ];
684
685 strictDeps = true;
686
687 # The ruby build script takes care of this
688 dontUseCmakeConfigure = true;
689
690 postInstall = ''
691 # Reduce output size by a lot, and remove some unnecessary references.
692 # The ext directory should only be required at build time, so
693 # can be deleted now.
694 rm -r $out/${ruby.gemPath}/gems/mathematical-${attrs.version}/ext \
695 $out/${ruby.gemPath}/extensions/*/*/mathematical-${attrs.version}/gem_make.out
696 '';
697
698 # For some reason 'mathematical.so' is missing cairo, glib, and
699 # lasem in its RPATH, add them explicitly here
700 postFixup =
701 lib.optionalString stdenv.hostPlatform.isLinux ''
702 soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
703 rpath="$(patchelf --print-rpath "$soPath")"
704 patchelf --set-rpath "${
705 lib.makeLibraryPath [
706 lasem
707 glib
708 cairo
709 ]
710 }:$rpath" "$soPath"
711 patchelf --replace-needed liblasem.so liblasem-0.4.so "$soPath"
712 ''
713 + lib.optionalString stdenv.hostPlatform.isDarwin ''
714 soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.bundle"
715 install_name_tool -add_rpath "${
716 lib.makeLibraryPath [
717 lasem
718 glib
719 cairo
720 ]
721 }/lib" "$soPath"
722 install_name_tool -change @rpath/liblasem.dylib "${lib.getLib lasem}/lib/liblasem-0.4.dylib" "$soPath"
723 '';
724 };
725
726 magic = attrs: {
727 buildInputs = [ file ];
728 postInstall = ''
729 installPath=$(cat $out/nix-support/gem-meta/install-path)
730 sed -e 's@ENV\["MAGIC_LIB"\] ||@ENV\["MAGIC_LIB"\] || "${file}/lib/libmagic.so" ||@' -i $installPath/lib/magic/api.rb
731 '';
732 };
733
734 maxmind_geoip2 = attrs: {
735 buildFlags = [
736 "--with-maxminddb-lib=${libmaxminddb}/lib"
737 "--with-maxminddb-include=${libmaxminddb}/include"
738 ];
739 };
740
741 metasploit-framework = attrs: {
742 preInstall = ''
743 export HOME=$TMPDIR
744 '';
745 };
746
747 mysql = attrs: {
748 buildInputs = [
749 libmysqlclient
750 zlib
751 openssl
752 ];
753 };
754
755 mysql2 = attrs: {
756 buildInputs = [
757 libmysqlclient
758 zlib
759 openssl
760 ];
761 };
762
763 ncursesw = attrs: {
764 buildInputs = [ ncurses ];
765 buildFlags = [
766 "--with-cflags=-I${ncurses.dev}/include"
767 "--with-ldflags=-L${ncurses.out}/lib"
768 ];
769 };
770
771 nokogiri =
772 attrs:
773 (
774 {
775 buildFlags = [
776 "--use-system-libraries"
777 "--with-zlib-lib=${zlib.out}/lib"
778 "--with-zlib-include=${zlib.dev}/include"
779 "--with-xml2-lib=${libxml2.out}/lib"
780 "--with-xml2-include=${libxml2.dev}/include/libxml2"
781 "--with-xslt-lib=${libxslt.out}/lib"
782 "--with-xslt-include=${libxslt.dev}/include"
783 "--with-exslt-lib=${libxslt.out}/lib"
784 "--with-exslt-include=${libxslt.dev}/include"
785 ]
786 ++ lib.optionals stdenv.hostPlatform.isDarwin [
787 "--with-iconv-dir=${libiconv}"
788 "--with-opt-include=${libiconv}/include"
789 ];
790 }
791 // lib.optionalAttrs stdenv.hostPlatform.isDarwin {
792 buildInputs = [ libxml2 ];
793
794 # libxml 2.12 upgrade requires these fixes
795 # https://github.com/sparklemotion/nokogiri/pull/3032
796 # which don't trivially apply to older versions
797 meta.broken =
798 (lib.versionOlder attrs.version "1.16.0") && (lib.versionAtLeast libxml2.version "2.12");
799 }
800 );
801
802 openssl = attrs: {
803 # https://github.com/ruby/openssl/issues/369
804 buildInputs = [ (if (lib.versionAtLeast attrs.version "3.0.0") then openssl else openssl_1_1) ];
805 };
806
807 opus-ruby = attrs: {
808 dontBuild = false;
809 postPatch = ''
810 substituteInPlace lib/opus-ruby.rb \
811 --replace "ffi_lib 'opus'" \
812 "ffi_lib '${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}'"
813 '';
814 };
815
816 ovirt-engine-sdk = attrs: {
817 buildInputs = [
818 curl
819 libxml2
820 ];
821 # https://github.com/oVirt/ovirt-engine-sdk-ruby/issues/13
822 env.NIX_CFLAGS_COMPILE = toString [
823 "-Wno-error=implicit-function-declaration"
824 "-Wno-error=incompatible-pointer-types"
825 "-Wno-int-conversion"
826 ];
827 dontBuild = false;
828 meta.broken = stdenv.hostPlatform.isDarwin; # At least until releasing https://github.com/oVirt/ovirt-engine-sdk-ruby/pull/17
829 };
830
831 pango = attrs: {
832 nativeBuildInputs = [
833 pkg-config
834 ]
835 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
836 buildInputs = [
837 libdatrie
838 libthai
839 fribidi
840 harfbuzz
841 libsysprof-capture
842 pcre2
843 libpthread-stubs
844 libxdmcp
845 ]
846 ++ lib.optionals stdenv.hostPlatform.isLinux [
847 libselinux
848 libsepol
849 util-linux
850 ];
851 propagatedBuildInputs = [
852 gobject-introspection
853 wrapGAppsHook3
854 ];
855 };
856
857 patron = attrs: {
858 buildInputs = [ curl ];
859 };
860
861 pcaprub = attrs: {
862 buildInputs = [ libpcap ];
863 };
864
865 pg = attrs: {
866 # Force pkg-config lookup for libpq.
867 # See https://github.com/ged/ruby-pg/blob/6629dec6656f7ca27619e4675b45225d9e422112/ext/extconf.rb#L34-L55
868 #
869 # Note that setting --with-pg-config=${postgresql.pg_config}/bin/pg_config would add
870 # an unnecessary reference to the entire postgresql package.
871 buildFlags = [ "--with-pg-config=ignore" ];
872 nativeBuildInputs = [ pkg-config ];
873 buildInputs = [ libpq ];
874 };
875
876 rszr = attrs: {
877 buildInputs = [
878 imlib2
879 imlib2.dev
880 ];
881 buildFlags = [ "--without-imlib2-config" ];
882 };
883
884 psych = attrs: {
885 buildInputs = [ libyaml ];
886 };
887
888 puma = attrs: {
889 buildInputs = [ openssl ];
890 };
891
892 "pygments.rb" = attrs: {
893 buildInputs = [ python3 ];
894 };
895
896 rack = attrs: {
897 meta.mainProgram = "rackup";
898 };
899
900 railties = attrs: {
901 meta.mainProgram = "rails";
902 };
903
904 rainbow = attrs: {
905 buildInputs = [ rainbow_rake ];
906 };
907
908 rbczmq =
909 { ... }:
910 {
911 buildInputs = [
912 zeromq
913 czmq
914 ];
915 buildFlags = [ "--with-system-libs" ];
916 };
917
918 rbnacl =
919 spec:
920 if lib.versionOlder spec.version "6.0.0" then
921 {
922 postInstall = ''
923 sed -i $(cat $out/nix-support/gem-meta/install-path)/lib/rbnacl.rb -e "2a \
924 RBNACL_LIBSODIUM_GEM_LIB_PATH = '${libsodium.out}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}'
925 "
926 '';
927 }
928 else
929 {
930 dontBuild = false;
931 postPatch = ''
932 substituteInPlace lib/rbnacl/sodium.rb \
933 --replace 'ffi_lib ["sodium"' \
934 'ffi_lib ["${libsodium}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}"'
935 '';
936 };
937
938 re2 = attrs: {
939 buildInputs = [ re2 ];
940 buildFlags = [
941 "--enable-system-libraries"
942 ];
943 };
944
945 rest-client = attrs: {
946 meta.mainProgram = "restclient";
947 };
948
949 rmagick = attrs: {
950 nativeBuildInputs = [ pkg-config ];
951 buildInputs = [
952 imagemagick
953 which
954 ];
955 };
956
957 rouge = attrs: {
958 meta.mainProgram = "rougify";
959 };
960
961 rpam2 = attrs: {
962 buildInputs = [ linux-pam ];
963 };
964
965 rspec-core = attrs: {
966 meta.mainProgram = "rspec";
967 };
968
969 ruby-libvirt = attrs: {
970 nativeBuildInputs = [ pkg-config ];
971 buildInputs = [ libvirt ];
972 buildFlags = [
973 "--with-libvirt-include=${libvirt}/include"
974 "--with-libvirt-lib=${libvirt}/lib"
975 ];
976 };
977
978 ruby-lxc = attrs: {
979 buildInputs = [ lxc ];
980 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
981 };
982
983 ruby-terminfo = attrs: {
984 buildInputs = [ ncurses ];
985 buildFlags = [
986 "--with-cflags=-I${ncurses.dev}/include"
987 "--with-ldflags=-L${ncurses.out}/lib"
988 ];
989 dontBuild = false;
990 postPatch = ''
991 substituteInPlace extconf.rb --replace 'rubyio.h' 'ruby/io.h'
992 substituteInPlace terminfo.c \
993 --replace 'rubyio.h' 'ruby/io.h' \
994 --replace 'rb_cData' 'rb_cObject'
995 '';
996 };
997
998 ruby-vips = attrs: {
999 postInstall = ''
1000 cd "$(cat $out/nix-support/gem-meta/install-path)"
1001
1002 substituteInPlace lib/vips.rb \
1003 --replace 'FFI.library_name("vips", 42)' '"${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}"' \
1004 --replace 'FFI.library_name("glib-2.0", 0)' '"${glib.out}/lib/libglib-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' \
1005 --replace 'FFI.library_name("gobject-2.0", 0)' '"${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' \
1006 --replace 'library_name("vips", 42)' '"${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}"' \
1007 --replace 'library_name("glib-2.0", 0)' '"${glib.out}/lib/libglib-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' \
1008 --replace 'library_name("gobject-2.0", 0)' '"${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"'
1009 '';
1010 };
1011
1012 rugged = attrs: {
1013 nativeBuildInputs = [
1014 cmake
1015 pkg-config
1016 which
1017 ]
1018 ++ lib.optional stdenv.hostPlatform.isDarwin libiconv;
1019 buildInputs = [
1020 openssl
1021 libssh2
1022 zlib
1023 ];
1024 dontUseCmakeConfigure = true;
1025 buildFlags = [ "--with-ssh" ];
1026 };
1027
1028 sassc = attrs: {
1029 nativeBuildInputs = [ rake ];
1030 dontBuild = false;
1031 SASS_LIBSASS_PATH = toString libsass;
1032 postPatch = ''
1033 substituteInPlace lib/sassc/native.rb \
1034 --replace 'gem_root = spec.gem_dir' 'gem_root = File.join(__dir__, "../../")'
1035 '';
1036 };
1037
1038 sass-embedded = attrs: {
1039 # Patch the Rakefile to use our dart-sass and not try to fetch anything.
1040 dontBuild = false;
1041 postPatch = ''
1042 substituteInPlace ext/sass/Rakefile \
1043 --replace \'dart-sass/sass\' \'${dart-sass}/bin/sass\' \
1044 --replace ' => %w[dart-sass]' ""
1045 '';
1046 };
1047
1048 scrypt =
1049 attrs:
1050 lib.optionalAttrs stdenv.hostPlatform.isDarwin {
1051 dontBuild = false;
1052 postPatch = ''
1053 sed -i -e "s/-arch i386//" Rakefile ext/scrypt/Rakefile
1054 '';
1055 };
1056
1057 semian = attrs: {
1058 buildInputs = [ openssl ];
1059 };
1060
1061 sequel_pg = attrs: {
1062 buildInputs = [ libpq ];
1063 };
1064
1065 snappy = attrs: {
1066 buildInputs = [ args.snappy ];
1067 };
1068
1069 sqlite3 =
1070 attrs:
1071 if lib.versionAtLeast attrs.version "1.5.0" then
1072 {
1073 nativeBuildInputs = [ pkg-config ];
1074 buildInputs = [ sqlite ];
1075 buildFlags = [
1076 "--enable-system-libraries"
1077 ];
1078 }
1079 else
1080 {
1081 buildFlags = [
1082 "--with-sqlite3-include=${sqlite.dev}/include"
1083 "--with-sqlite3-lib=${sqlite.out}/lib"
1084 ];
1085 env.NIX_CFLAGS_COMPILE = toString [
1086 "-Wno-error=incompatible-pointer-types"
1087 "-Wno-error=int-conversion"
1088 ];
1089 };
1090
1091 rb-readline = attrs: {
1092 dontBuild = false;
1093 postPatch = ''
1094 substituteInPlace lib/rbreadline.rb \
1095 --replace 'infocmp' '${ncurses}/bin/infocmp'
1096 '';
1097 };
1098
1099 taglib-ruby = attrs: {
1100 buildInputs = [ taglib ];
1101 };
1102
1103 timfel-krb5-auth = attrs: {
1104 buildInputs = [ libkrb5 ];
1105 };
1106
1107 tiny_tds = attrs: {
1108 nativeBuildInputs = [
1109 pkg-config
1110 openssl
1111 ];
1112 buildInputs = [ freetds ];
1113 };
1114
1115 treetop = attrs: {
1116 meta.mainProgram = "tt";
1117 };
1118
1119 trilogy = attrs: {
1120 postInstall = ''
1121 installPath=$(cat "$out/nix-support/gem-meta/install-path")
1122 ln -s contrib/ruby/trilogy.gemspec "$installPath/trilogy.gemspec"
1123 '';
1124 };
1125
1126 typhoeus = attrs: {
1127 buildInputs = [ curl ];
1128 };
1129
1130 tzinfo =
1131 attrs:
1132 lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") {
1133 dontBuild = false;
1134 postPatch =
1135 let
1136 path =
1137 if lib.versionAtLeast attrs.version "2.0" then
1138 "lib/tzinfo/data_sources/zoneinfo_data_source.rb"
1139 else
1140 "lib/tzinfo/zoneinfo_data_source.rb";
1141 in
1142 ''
1143 substituteInPlace ${path} \
1144 --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
1145 '';
1146 };
1147
1148 uuid4r = attrs: {
1149 buildInputs = [
1150 which
1151 libossp_uuid
1152 ];
1153 };
1154
1155 whois = attrs: {
1156 meta.mainProgram = "whoisrb";
1157 };
1158
1159 xapian-ruby = attrs: {
1160 # use the system xapian
1161 dontBuild = false;
1162 nativeBuildInputs = [
1163 rake
1164 pkg-config
1165 bundler
1166 ];
1167 buildInputs = [
1168 xapian
1169 zlib
1170 ];
1171 postPatch = ''
1172 cp ${./xapian-Rakefile} Rakefile
1173 '';
1174 preInstall = ''
1175 export XAPIAN_CONFIG=${xapian}/bin/xapian-config
1176 '';
1177 };
1178
1179 zlib = attrs: {
1180 buildInputs = [ zlib ];
1181 };
1182
1183 zookeeper = attrs: {
1184 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ cctools ];
1185 };
1186}