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