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