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, fetchpatch2, 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, pcre2, gecode_3, curl
24, libsodium, snappy, libossp_uuid, lxc, libpcap, xorg, gtk3, lerc, 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, libsysprof-capture
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.hostPlatform.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.hostPlatform.isDarwin [ DarwinTools ];
74 buildInputs = [ cairo expat glib libsysprof-capture pcre2 xorg.libpthreadstubs xorg.libXdmcp ];
75 };
76
77 cairo-gobject = attrs: {
78 nativeBuildInputs = [ pkg-config ]
79 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
80 buildInputs = [ cairo expat libsysprof-capture 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 dontBuild = false;
130 buildInputs = [ ncurses ];
131 patches = lib.optionals (lib.versionOlder attrs.version "1.4.5") [
132 # Fixes incompatible function pointer type error with clang 16. Fixed in 1.4.5 and newer.
133 # Upstream issue: https://github.com/ruby/curses/issues/85
134 (fetchpatch2 {
135 url = "https://github.com/ruby/curses/commit/13e00d07c3aaed83d5f138cf268cc33c9f025d0e.patch?full_index=1";
136 hash = "sha256-ZJ2egqj3Uwmi4KrF79dtwczpwUqFCp52/xQYUymYDmc=";
137 })
138 ];
139 };
140
141 dep-selector-libgecode = attrs: {
142 USE_SYSTEM_GECODE = true;
143 postInstall = ''
144 installPath=$(cat $out/nix-support/gem-meta/install-path)
145 sed -i $installPath/lib/dep-selector-libgecode.rb -e 's@VENDORED_GECODE_DIR =.*@VENDORED_GECODE_DIR = "${gecode_3}"@'
146 '';
147 };
148
149 digest-sha3 = attrs: {
150 hardeningDisable = [ "format" ];
151 };
152
153 rdiscount = attrs: {
154 # Use discount from nixpkgs instead of vendored version
155 dontBuild = false;
156 buildInputs = [ discount ];
157 patches = [
158 # Adapted from Debian:
159 # https://sources.debian.org/data/main/r/ruby-rdiscount/2.1.8-1/debian/patches/01_use-system-libmarkdown.patch
160 ./rdiscount-use-nixpkgs-libmarkdown.patch
161 ];
162 };
163
164 ethon = attrs: {
165 dontBuild = false;
166 postPatch = ''
167 substituteInPlace lib/ethon/curls/settings.rb \
168 --replace "libcurl" "${curl.out}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary}"
169 '';
170 };
171
172 exiv2 = attrs: {
173 buildFlags = [ "--with-exiv2-lib=${exiv2}/lib" "--with-exiv2-include=${exiv2.dev}/include" ];
174 };
175
176 fog-dnsimple = attrs:
177 lib.optionalAttrs (lib.versionOlder attrs.version "1.0.1") {
178 postInstall = ''
179 cd $(cat $out/nix-support/gem-meta/install-path)
180 rm {$out/bin,bin,../../bin}/{setup,console}
181 '';
182 };
183
184 redis-rack = attrs: {
185 dontBuild = false;
186 preBuild = ''
187 exec 3>&1
188 output="$(gem build $gemspec | tee >(cat - >&3))"
189 exec 3>&-
190 sed -i 's!"rake".freeze!!' $gemspec
191 '';
192 };
193
194 ffi-rzmq-core = attrs: {
195 postInstall = ''
196 installPath=$(cat $out/nix-support/gem-meta/install-path)
197 sed -i $installPath/lib/ffi-rzmq-core/libzmq.rb -e 's@inside_gem =.*@inside_gem = "${zeromq}/lib"@'
198 '';
199 };
200
201 mimemagic = attrs: {
202 FREEDESKTOP_MIME_TYPES_PATH = "${shared-mime-info}/share/mime/packages/freedesktop.org.xml";
203 };
204
205 mini_magick = attrs: {
206 postInstall = ''
207 installPath=$(cat $out/nix-support/gem-meta/install-path)
208 echo -e "\nENV['PATH'] += ':${graphicsmagick}/bin'\n" >> $installPath/lib/mini_magick/configuration.rb
209 '';
210 };
211
212 do_sqlite3 = attrs: {
213 buildInputs = [ sqlite ];
214 };
215
216 eventmachine = attrs: {
217 dontBuild = false;
218 buildInputs = [ openssl ];
219 postPatch = ''
220 substituteInPlace ext/em.cpp \
221 --replace 'if (bind (' 'if (::bind ('
222 '';
223 };
224
225 exif = attrs: {
226 buildFlags = [ "--with-exif-dir=${libexif}" ];
227 buildInputs = [ libexif ];
228 };
229
230 ffi = attrs: {
231 nativeBuildInputs = [ pkg-config ];
232 buildInputs = [ libffi ];
233 };
234
235 fiddle = attrs: {
236 buildInputs = [ libffi ];
237 };
238
239 gdk_pixbuf2 = attrs: {
240 nativeBuildInputs = [ pkg-config bundler rake ]
241 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
242 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook3 gdk-pixbuf ];
243 };
244
245 gdk3 = attrs: {
246 nativeBuildInputs = [ pkg-config bundler rake ]
247 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
248 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook3 gdk-pixbuf cairo ];
249 };
250
251 gpgme = attrs: {
252 buildInputs = [ gpgme ];
253 nativeBuildInputs = [ pkg-config ];
254 buildFlags = [ "--use-system-libraries" ];
255 };
256
257 gio2 = attrs: {
258 nativeBuildInputs = [ pkg-config gobject-introspection ]
259 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
260 buildInputs = [ glib libsysprof-capture pcre2 ] ++ lib.optionals stdenv.hostPlatform.isLinux [ util-linux libselinux libsepol ];
261 };
262
263 gitlab-markup = attrs: { meta.priority = 1; };
264
265 gitlab-pg_query = attrs: lib.optionalAttrs (attrs.version == "1.3.1") {
266 dontBuild = false;
267 postPatch = ''
268 sed -i "s;'https://codeload.github.com.*';'${fetchurl {
269 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.3";
270 sha256 = "0jfij8apzxsdabl70j42xgd5f3ka1gdcrk764nccp66164gpcchk";
271 }}';" ext/pg_query/extconf.rb
272 '';
273 };
274
275 parser = attrs: {
276 meta.mainProgram = "ruby-parse";
277 };
278
279 pg_query = attrs: lib.optionalAttrs (attrs.version == "2.0.2") {
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/13-2.0.2";
284 sha256 = "0ms2s6hmy8qyzv4g1hj4i2p5fws1v8lrj73b2knwbp2ipd45yj7y";
285 }}';" ext/pg_query/extconf.rb
286 '';
287 } // lib.optionalAttrs (attrs.version == "1.3.0") {
288 # Needed for gitlab
289 dontBuild = false;
290 postPatch = ''
291 sed -i "s;'https://codeload.github.com.*';'${fetchurl {
292 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.4";
293 sha256 = "0f0kshhai0pnkqj0w4kgz3fssnvwidllc31n1fysxjjzdqlr1k48";
294 }}';" ext/pg_query/extconf.rb
295 '';
296 };
297
298 prettier = attrs: {
299 meta.mainProgram = "rbprettier";
300 };
301
302 prometheus-client-mmap = attrs: {
303 dontBuild = false;
304 postPatch = let
305 getconf = if stdenv.hostPlatform.isGnu then stdenv.cc.libc else getconf;
306 in ''
307 substituteInPlace lib/prometheus/client/page_size.rb --replace "getconf" "${lib.getBin getconf}/bin/getconf"
308 '';
309 } // lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") {
310 cargoRoot = "ext/fast_mmaped_file_rs";
311 cargoDeps = rustPlatform.fetchCargoTarball {
312 src = stdenv.mkDerivation {
313 inherit (buildRubyGem { inherit (attrs) gemName version source; })
314 name
315 src
316 unpackPhase
317 nativeBuildInputs
318 ;
319 dontBuilt = true;
320 installPhase = ''
321 cp -R ext/fast_mmaped_file_rs $out
322 '';
323 };
324 hash = if lib.versionAtLeast attrs.version "1.1.1"
325 then "sha256-RsN5XWX7Mj2ORccM0eczY+44WXsbXNTnJVcCMvnOATk="
326 else "sha256-XuQZPbFWqPHlrJvllkvLl1FjKeoAUbi8oKDrS2rY1KM=";
327 };
328 nativeBuildInputs = [
329 cargo
330 rustc
331 rustPlatform.cargoSetupHook
332 rustPlatform.bindgenHook
333 ];
334 disallowedReferences = [
335 rustc.unwrapped
336 ];
337 preBuild = ''
338 cat ../.cargo/config.toml > ext/fast_mmaped_file_rs/.cargo/config.toml
339 sed -i "s|cargo-vendor-dir|$PWD/../cargo-vendor-dir|" ext/fast_mmaped_file_rs/.cargo/config.toml
340 '';
341 postInstall = ''
342 find $out -type f -name .rustc_info.json -delete
343 '';
344 };
345
346 glib2 = attrs: {
347 nativeBuildInputs = [ pkg-config ]
348 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
349 buildInputs = [ glib libsysprof-capture pcre2 ];
350 };
351
352 gtk3 = attrs: {
353 nativeBuildInputs = [
354 binutils
355 pkg-config
356 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
357 util-linux
358 libselinux
359 libsepol
360 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
361 propagatedBuildInputs = [
362 atk
363 gdk-pixbuf
364 fribidi
365 gobject-introspection
366 gtk3
367 cairo
368 harfbuzz
369 lerc
370 libdatrie
371 libsysprof-capture
372 libthai
373 pcre2
374 xorg.libpthreadstubs
375 xorg.libXdmcp
376 xorg.libXtst
377 libxkbcommon
378 libepoxy
379 ];
380 dontStrip = stdenv.hostPlatform.isDarwin;
381 };
382
383 gobject-introspection = attrs: {
384 nativeBuildInputs = [ pkg-config ]
385 ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
386 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook3 glib pcre2 libsysprof-capture ];
387 };
388
389 gollum = attrs: {
390 dontBuild = false;
391 postPatch = ''
392 substituteInPlace bin/gollum \
393 --replace "/usr/bin/env -S ruby" "${ruby}/bin/ruby"
394 '';
395 };
396
397 google-protobuf = attrs:
398 lib.optionalAttrs (lib.versionAtLeast attrs.version "3.25.0") {
399 # Fails on 3.25.0 with:
400 # convert.c:312:32: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
401 hardeningDisable = [ "format" ];
402 };
403
404 grpc = attrs: {
405 nativeBuildInputs = [ pkg-config ]
406 ++ lib.optional stdenv.hostPlatform.isDarwin cctools
407 ++ lib.optional (lib.versionAtLeast attrs.version "1.53.0" && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) autoSignDarwinBinariesHook;
408 buildInputs = [ openssl ];
409 hardeningDisable = [ "format" ];
410 env.NIX_CFLAGS_COMPILE = toString [
411 "-Wno-error=stringop-overflow"
412 "-Wno-error=implicit-fallthrough"
413 "-Wno-error=sizeof-pointer-memaccess"
414 "-Wno-error=cast-function-type"
415 "-Wno-error=class-memaccess"
416 "-Wno-error=ignored-qualifiers"
417 "-Wno-error=tautological-compare"
418 "-Wno-error=stringop-truncation"
419 ];
420 dontBuild = false;
421 postPatch = ''
422 substituteInPlace Makefile \
423 --replace '-Wno-invalid-source-encoding' ""
424 '' + lib.optionalString (lib.versionOlder attrs.version "1.53.0" && stdenv.hostPlatform.isDarwin) ''
425 # For < v1.48.0
426 substituteInPlace src/ruby/ext/grpc/extconf.rb \
427 --replace "ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/" ""
428 # For >= v1.48.0
429 substituteInPlace src/ruby/ext/grpc/extconf.rb \
430 --replace 'apple_toolchain = ' 'apple_toolchain = false && '
431 '';
432 };
433
434 hitimes = attrs: {
435 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices ];
436 };
437
438 hpricot = attrs: {
439 dontBuild = false;
440 patches = [
441 # Fix incompatible function pointer conversion errors with clang 16
442 ./hpricot-fix-incompatible-function-pointer-conversion.patch
443 ];
444 };
445
446 iconv = attrs: {
447 dontBuild = false;
448 buildFlags = lib.optionals stdenv.hostPlatform.isDarwin [
449 "--with-iconv-dir=${lib.getLib libiconv}"
450 "--with-iconv-include=${lib.getDev libiconv}/include"
451 ];
452 patches = [
453 # Fix incompatible function pointer conversion errors with clang 16
454 ./iconv-fix-incompatible-function-pointer-conversions.patch
455 ];
456 };
457
458 idn-ruby = attrs: {
459 buildInputs = [ libidn ];
460 };
461
462 # disable bundle install as it can't install anything in addition to what is
463 # specified in pkgs/applications/misc/jekyll/Gemfile anyway. Also do chmod_R
464 # to compensate for read-only files in site_template in nix store.
465 jekyll = attrs: {
466 postInstall = ''
467 installPath=$(cat $out/nix-support/gem-meta/install-path)
468 sed -i $installPath/lib/jekyll/commands/new.rb \
469 -e 's@Exec.run("bundle", "install"@Exec.run("true"@' \
470 -e 's@FileUtils.cp_r site_template + "/.", path@FileUtils.cp_r site_template + "/.", path; FileUtils.chmod_R "u+w", path@'
471 '';
472 };
473
474 # note that you need version >= v3.16.14.8,
475 # otherwise the gem will fail to link to the libv8 binary.
476 # see: https://github.com/cowboyd/libv8/pull/161
477 libv8 = attrs: {
478 buildInputs = [ which nodejs.libv8 python2 ];
479 buildFlags = [ "--with-system-v8=true" ];
480 dontBuild = false;
481 # The gem includes broken symlinks which are ignored during unpacking, but
482 # then fail during build. Since the content is missing anyway, touching the
483 # files is enough to unblock the build.
484 preBuild = ''
485 touch vendor/depot_tools/cbuildbot vendor/depot_tools/chrome_set_ver vendor/depot_tools/cros_sdk
486 '';
487 postPatch = ''
488 substituteInPlace ext/libv8/extconf.rb \
489 --replace "location = Libv8::Location::Vendor.new" \
490 "location = Libv8::Location::System.new"
491 '';
492 meta.broken = true; # At 2023-01-20, errors as:
493 # "Failed to build gem native extension."
494 # Requires Python 2. Project is abandoned.
495 };
496
497 execjs = attrs: {
498 propagatedBuildInputs = [ nodejs.libv8 ];
499 };
500
501 libxml-ruby = attrs: {
502 buildFlags = [
503 "--with-xml2-lib=${libxml2.out}/lib"
504 "--with-xml2-include=${libxml2.dev}/include/libxml2"
505 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
506 "--with-iconv-dir=${lib.getLib libiconv}"
507 "--with-opt-include=${lib.getDev libiconv}/include"
508 ];
509 };
510
511 mathematical = attrs: {
512 nativeBuildInputs = [
513 ruby
514 cmake
515 bison
516 flex
517 pkg-config
518 python3
519 patchelf
520 ];
521
522 buildInputs = [
523 cairo
524 fribidi
525 gdk-pixbuf
526 glib
527 libxml2
528 pango
529 ];
530
531 strictDeps = true;
532
533 # The ruby build script takes care of this
534 dontUseCmakeConfigure = true;
535
536 postInstall = ''
537 # Reduce output size by a lot, and remove some unnecessary references.
538 # The ext directory should only be required at build time, so
539 # can be deleted now.
540 rm -r $out/${ruby.gemPath}/gems/mathematical-${attrs.version}/ext \
541 $out/${ruby.gemPath}/extensions/*/*/mathematical-${attrs.version}/gem_make.out
542 '';
543
544 # For some reason 'mathematical.so' is missing cairo, glib, and
545 # lasem in its RPATH, add them explicitly here
546 postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
547 soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
548 rpath="$(patchelf --print-rpath "$soPath")"
549 patchelf --set-rpath "${lib.makeLibraryPath [ lasem glib cairo ]}:$rpath" "$soPath"
550 patchelf --replace-needed liblasem.so liblasem-0.4.so "$soPath"
551 '';
552 };
553
554 magic = attrs: {
555 buildInputs = [ file ];
556 postInstall = ''
557 installPath=$(cat $out/nix-support/gem-meta/install-path)
558 sed -e 's@ENV\["MAGIC_LIB"\] ||@ENV\["MAGIC_LIB"\] || "${file}/lib/libmagic.so" ||@' -i $installPath/lib/magic/api.rb
559 '';
560 };
561
562 maxmind_geoip2 = attrs: {
563 buildFlags = [ "--with-maxminddb-lib=${libmaxminddb}/lib" "--with-maxminddb-include=${libmaxminddb}/include" ];
564 };
565
566 metasploit-framework = attrs: {
567 preInstall = ''
568 export HOME=$TMPDIR
569 '';
570 };
571
572 mysql = attrs: {
573 buildInputs = [ libmysqlclient zlib openssl ];
574 };
575
576 mysql2 = attrs: {
577 buildInputs = [ libmysqlclient zlib openssl ];
578 };
579
580 ncursesw = attrs: {
581 buildInputs = [ ncurses ];
582 buildFlags = [
583 "--with-cflags=-I${ncurses.dev}/include"
584 "--with-ldflags=-L${ncurses.out}/lib"
585 ];
586 };
587
588 nokogiri = attrs: ({
589 buildFlags = [
590 "--use-system-libraries"
591 "--with-zlib-lib=${zlib.out}/lib"
592 "--with-zlib-include=${zlib.dev}/include"
593 "--with-xml2-lib=${libxml2.out}/lib"
594 "--with-xml2-include=${libxml2.dev}/include/libxml2"
595 "--with-xslt-lib=${libxslt.out}/lib"
596 "--with-xslt-include=${libxslt.dev}/include"
597 "--with-exslt-lib=${libxslt.out}/lib"
598 "--with-exslt-include=${libxslt.dev}/include"
599 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
600 "--with-iconv-dir=${libiconv}"
601 "--with-opt-include=${libiconv}/include"
602 ];
603 } // lib.optionalAttrs stdenv.hostPlatform.isDarwin {
604 buildInputs = [ libxml2 ];
605
606 # libxml 2.12 upgrade requires these fixes
607 # https://github.com/sparklemotion/nokogiri/pull/3032
608 # which don't trivially apply to older versions
609 meta.broken = (lib.versionOlder attrs.version "1.16.0") && (lib.versionAtLeast libxml2.version "2.12");
610 });
611
612 openssl = attrs: {
613 # https://github.com/ruby/openssl/issues/369
614 buildInputs = [ (if (lib.versionAtLeast attrs.version "3.0.0") then openssl else openssl_1_1) ];
615 };
616
617 opus-ruby = attrs: {
618 dontBuild = false;
619 postPatch = ''
620 substituteInPlace lib/opus-ruby.rb \
621 --replace "ffi_lib 'opus'" \
622 "ffi_lib '${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}'"
623 '';
624 };
625
626 ovirt-engine-sdk = attrs: {
627 buildInputs = [ curl libxml2 ];
628 dontBuild = false;
629 meta.broken = stdenv.hostPlatform.isDarwin; # At least until releasing https://github.com/oVirt/ovirt-engine-sdk-ruby/pull/17
630 };
631
632 pango = attrs: {
633 nativeBuildInputs = [
634 pkg-config
635 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ DarwinTools ];
636 buildInputs = [ libdatrie libthai fribidi harfbuzz libsysprof-capture pcre2 xorg.libpthreadstubs xorg.libXdmcp ]
637 ++ lib.optionals stdenv.hostPlatform.isLinux [ libselinux libsepol util-linux ];
638 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook3 ];
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=${lib.getDev 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.hostPlatform.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.hostPlatform.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.hostPlatform.isDarwin [ cctools ];
902 };
903}