1 # The standard set of gems in nixpkgs including potential fixes.
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).
10 # sha256 = "1s4x0f5by9xs2y24jk6krq5ky7ffkzmxgr4z1nhdykdmpsi2zd0l";
11 # dependencies = [ "rake" ];
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
17 # This separates "what to build" (the exact gem versions) from "how to build"
18 # (to make gems behave if necessary).
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, 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, libmaxminddb, libyaml
30 , autoSignDarwinBinariesHook, fetchpatch
34 rainbow_rake = buildRubyGem {
37 source.sha256 = "01j8fc9bqjnrsxbppncai05h43315vmz9fwg28qdsgcjw9ck1d7n";
45 meta.mainProgram = "zentest";
49 dependencies = attrs.dependencies ++ [ "gobject-introspection" ];
50 nativeBuildInputs = [ rake bundler pkg-config ]
51 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
52 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook atk ];
57 templates = "${attrs.ruby.gemPath}/gems/${attrs.gemName}-${attrs.version}/lib/bundler/templates/";
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";
63 chmod +x $out/${templates}/Executable
65 # Allows to load another bundler version
66 sed -i -e "s/activate_bin_path/bin_path/g" $out/bin/bundle
71 nativeBuildInputs = [ pkg-config ]
72 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
73 buildInputs = [ gtk2 pcre2 xorg.libpthreadstubs xorg.libXdmcp];
76 cairo-gobject = attrs: {
77 nativeBuildInputs = [ pkg-config ]
78 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
79 buildInputs = [ cairo expat pcre2 xorg.libpthreadstubs xorg.libXdmcp ];
82 charlock_holmes = attrs: {
83 buildInputs = [ which icu zlib ];
87 nativeBuildInputs = [ pkg-config ];
88 buildInputs = [ protobuf ];
91 cocoapods-acknowledgements = attrs: {
92 dependencies = attrs.dependencies ++ [ "cocoapods" ];
95 cocoapods-deploy = attrs: {
96 dependencies = [ "cocoapods" ];
99 cocoapods-disable-podfile-validations = attrs: {
100 dependencies = [ "cocoapods" ];
103 cocoapods-generate = attrs: {
104 dependencies = attrs.dependencies ++ [ "cocoapods" ];
107 cocoapods-git_url_rewriter = attrs: {
108 dependencies = [ "cocoapods" ];
111 cocoapods-keys = attrs: {
112 dependencies = attrs.dependencies ++ [ "cocoapods" ];
115 cocoapods-open = attrs: {
116 dependencies = [ "cocoapods" ];
119 cocoapods-try-release-fix = attrs: {
120 dependencies = [ "cocoapods" ];
124 buildInputs = [ curl ];
128 buildInputs = [ ncurses ];
131 dep-selector-libgecode = attrs: {
132 USE_SYSTEM_GECODE = true;
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}"@'
139 digest-sha3 = attrs: {
140 hardeningDisable = [ "format" ];
144 # Use discount from nixpkgs instead of vendored version
146 buildInputs = [ discount ];
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
157 substituteInPlace lib/ethon/curls/settings.rb \
158 --replace "libcurl" "${curl.out}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary}"
163 buildFlags = [ "--with-exiv2-lib=${exiv2}/lib" "--with-exiv2-include=${exiv2.dev}/include" ];
166 fog-dnsimple = attrs:
167 lib.optionalAttrs (lib.versionOlder attrs.version "1.0.1") {
169 cd $(cat $out/nix-support/gem-meta/install-path)
170 rm {$out/bin,bin,../../bin}/{setup,console}
174 redis-rack = attrs: {
178 output="$(gem build $gemspec | tee >(cat - >&3))"
180 sed -i 's!"rake".freeze!!' $gemspec
184 ffi-rzmq-core = attrs: {
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"@'
192 FREEDESKTOP_MIME_TYPES_PATH = "${shared-mime-info}/share/mime/packages/freedesktop.org.xml";
195 mini_magick = attrs: {
197 installPath=$(cat $out/nix-support/gem-meta/install-path)
198 echo -e "\nENV['PATH'] += ':${graphicsmagick}/bin'\n" >> $installPath/lib/mini_magick/configuration.rb
202 do_sqlite3 = attrs: {
203 buildInputs = [ sqlite ];
206 eventmachine = attrs: {
208 buildInputs = [ openssl ];
210 substituteInPlace ext/em.cpp \
211 --replace 'if (bind (' 'if (::bind ('
216 buildFlags = [ "--with-exif-dir=${libexif}" ];
217 buildInputs = [ libexif ];
221 nativeBuildInputs = [ pkg-config ];
222 buildInputs = [ libffi ];
226 buildInputs = [ libffi ];
229 gdk_pixbuf2 = attrs: {
230 nativeBuildInputs = [ pkg-config bundler rake ]
231 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
232 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook gdk-pixbuf ];
236 buildInputs = [ gpgme ];
237 nativeBuildInputs = [ pkg-config ];
238 buildFlags = [ "--use-system-libraries" ];
242 nativeBuildInputs = [ pkg-config gobject-introspection ]
243 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
244 buildInputs = [ gtk2 pcre pcre2 ] ++ lib.optionals stdenv.isLinux [ util-linux libselinux libsepol ];
247 gitlab-markup = attrs: { meta.priority = 1; };
249 gitlab-pg_query = attrs: lib.optionalAttrs (attrs.version == "1.3.1") {
252 sed -i "s;'https://codeload.github.com.*';'${fetchurl {
253 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.3";
254 sha256 = "0jfij8apzxsdabl70j42xgd5f3ka1gdcrk764nccp66164gpcchk";
255 }}';" ext/pg_query/extconf.rb
260 meta.mainProgram = "ruby-parse";
263 pg_query = attrs: lib.optionalAttrs (attrs.version == "2.0.2") {
266 sed -i "s;'https://codeload.github.com.*';'${fetchurl {
267 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/13-2.0.2";
268 sha256 = "0ms2s6hmy8qyzv4g1hj4i2p5fws1v8lrj73b2knwbp2ipd45yj7y";
269 }}';" ext/pg_query/extconf.rb
271 } // lib.optionalAttrs (attrs.version == "1.3.0") {
275 sed -i "s;'https://codeload.github.com.*';'${fetchurl {
276 url = "https://codeload.github.com/lfittl/libpg_query/tar.gz/10-1.0.4";
277 sha256 = "0f0kshhai0pnkqj0w4kgz3fssnvwidllc31n1fysxjjzdqlr1k48";
278 }}';" ext/pg_query/extconf.rb
283 meta.mainProgram = "rbprettier";
286 prometheus-client-mmap = attrs: {
289 getconf = if stdenv.hostPlatform.isGnu then stdenv.cc.libc else getconf;
291 substituteInPlace lib/prometheus/client/page_size.rb --replace "getconf" "${lib.getBin getconf}/bin/getconf"
296 nativeBuildInputs = [ pkg-config ]
297 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
298 buildInputs = [ gtk2 pcre2 ];
302 nativeBuildInputs = [
304 ] ++ lib.optionals stdenv.isLinux [
305 util-linux libselinux libsepol
306 ] ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
307 propagatedBuildInputs = [
311 gobject-introspection
320 dontStrip = stdenv.isDarwin;
323 gobject-introspection = attrs: {
324 nativeBuildInputs = [ pkg-config pcre2 ]
325 ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
326 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook glib ];
332 substituteInPlace bin/gollum \
333 --replace "/usr/bin/env -S ruby" "${ruby}/bin/ruby"
337 google-protobuf = attrs:
338 lib.optionalAttrs (lib.versionAtLeast attrs.version "3.25.0") {
339 # Fails on 3.25.0 with:
340 # convert.c:312:32: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
341 hardeningDisable = [ "format" ];
345 nativeBuildInputs = [ pkg-config ]
346 ++ lib.optional stdenv.isDarwin cctools
347 ++ lib.optional (lib.versionAtLeast attrs.version "1.53.0" && stdenv.isDarwin && stdenv.isAarch64) autoSignDarwinBinariesHook;
348 buildInputs = [ openssl ];
349 hardeningDisable = [ "format" ];
350 env.NIX_CFLAGS_COMPILE = toString [
351 "-Wno-error=stringop-overflow"
352 "-Wno-error=implicit-fallthrough"
353 "-Wno-error=sizeof-pointer-memaccess"
354 "-Wno-error=cast-function-type"
355 "-Wno-error=class-memaccess"
356 "-Wno-error=ignored-qualifiers"
357 "-Wno-error=tautological-compare"
358 "-Wno-error=stringop-truncation"
362 substituteInPlace Makefile \
363 --replace '-Wno-invalid-source-encoding' ""
364 '' + lib.optionalString (lib.versionOlder attrs.version "1.53.0" && stdenv.isDarwin) ''
366 substituteInPlace src/ruby/ext/grpc/extconf.rb \
367 --replace "ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/" ""
369 substituteInPlace src/ruby/ext/grpc/extconf.rb \
370 --replace 'apple_toolchain = ' 'apple_toolchain = false && '
375 buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
380 buildFlags = lib.optional stdenv.isDarwin "--with-iconv-dir=${libiconv}";
382 # Fix incompatible function pointer conversion errors with clang 16
383 ./iconv-fix-incompatible-function-pointer-conversions.patch
388 buildInputs = [ libidn ];
391 # disable bundle install as it can't install anything in addition to what is
392 # specified in pkgs/applications/misc/jekyll/Gemfile anyway. Also do chmod_R
393 # to compensate for read-only files in site_template in nix store.
396 installPath=$(cat $out/nix-support/gem-meta/install-path)
397 sed -i $installPath/lib/jekyll/commands/new.rb \
398 -e 's@Exec.run("bundle", "install"@Exec.run("true"@' \
399 -e 's@FileUtils.cp_r site_template + "/.", path@FileUtils.cp_r site_template + "/.", path; FileUtils.chmod_R "u+w", path@'
403 # note that you need version >= v3.16.14.8,
404 # otherwise the gem will fail to link to the libv8 binary.
405 # see: https://github.com/cowboyd/libv8/pull/161
407 buildInputs = [ which v8 python2 ];
408 buildFlags = [ "--with-system-v8=true" ];
410 # The gem includes broken symlinks which are ignored during unpacking, but
411 # then fail during build. Since the content is missing anyway, touching the
412 # files is enough to unblock the build.
414 touch vendor/depot_tools/cbuildbot vendor/depot_tools/chrome_set_ver vendor/depot_tools/cros_sdk
417 substituteInPlace ext/libv8/extconf.rb \
418 --replace "location = Libv8::Location::Vendor.new" \
419 "location = Libv8::Location::System.new"
421 meta.broken = true; # At 2023-01-20, errors as:
422 # "Failed to build gem native extension."
423 # Requires Python 2. Project is abandoned.
427 propagatedBuildInputs = [ v8 ];
430 libxml-ruby = attrs: {
432 "--with-xml2-lib=${libxml2.out}/lib"
433 "--with-xml2-include=${libxml2.dev}/include/libxml2"
434 ] ++ lib.optionals stdenv.isDarwin [
435 "--with-iconv-dir=${libiconv}"
436 "--with-opt-include=${libiconv}/include"
440 mathematical = attrs: {
441 nativeBuildInputs = [
462 # The ruby build script takes care of this
463 dontUseCmakeConfigure = true;
466 # Reduce output size by a lot, and remove some unnecessary references.
467 # The ext directory should only be required at build time, so
468 # can be deleted now.
469 rm -r $out/${ruby.gemPath}/gems/mathematical-${attrs.version}/ext \
470 $out/${ruby.gemPath}/extensions/*/*/mathematical-${attrs.version}/gem_make.out
473 # For some reason 'mathematical.so' is missing cairo, glib, and
474 # lasem in its RPATH, add them explicitly here
475 postFixup = lib.optionalString stdenv.isLinux ''
476 soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
477 rpath="$(patchelf --print-rpath "$soPath")"
478 patchelf --set-rpath "${lib.makeLibraryPath [ lasem glib cairo ]}:$rpath" "$soPath"
479 patchelf --replace-needed liblasem.so liblasem-0.4.so "$soPath"
484 buildInputs = [ file ];
486 installPath=$(cat $out/nix-support/gem-meta/install-path)
487 sed -e 's@ENV\["MAGIC_LIB"\] ||@ENV\["MAGIC_LIB"\] || "${file}/lib/libmagic.so" ||@' -i $installPath/lib/magic/api.rb
491 maxmind_geoip2 = attrs: {
492 buildFlags = [ "--with-maxminddb-lib=${libmaxminddb}/lib" "--with-maxminddb-include=${libmaxminddb}/include" ];
495 metasploit-framework = attrs: {
502 buildInputs = [ msgpack ];
506 buildInputs = [ libmysqlclient zlib openssl ];
510 buildInputs = [ libmysqlclient zlib openssl ];
514 buildInputs = [ ncurses ];
516 "--with-cflags=-I${ncurses.dev}/include"
517 "--with-ldflags=-L${ncurses.out}/lib"
523 "--use-system-libraries"
524 "--with-zlib-lib=${zlib.out}/lib"
525 "--with-zlib-include=${zlib.dev}/include"
526 "--with-xml2-lib=${libxml2.out}/lib"
527 "--with-xml2-include=${libxml2.dev}/include/libxml2"
528 "--with-xslt-lib=${libxslt.out}/lib"
529 "--with-xslt-include=${libxslt.dev}/include"
530 "--with-exslt-lib=${libxslt.out}/lib"
531 "--with-exslt-include=${libxslt.dev}/include"
532 ] ++ lib.optionals stdenv.isDarwin [
533 "--with-iconv-dir=${libiconv}"
534 "--with-opt-include=${libiconv}/include"
539 # https://github.com/ruby/openssl/issues/369
540 buildInputs = [ (if (lib.versionAtLeast attrs.version "3.0.0") then openssl else openssl_1_1) ];
546 substituteInPlace lib/opus-ruby.rb \
547 --replace "ffi_lib 'opus'" \
548 "ffi_lib '${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}'"
552 ovirt-engine-sdk = attrs: {
553 buildInputs = [ curl libxml2 ];
556 # fix ruby 3.1 https://github.com/oVirt/ovirt-engine-sdk-ruby/pull/3
558 url = "https://github.com/oVirt/ovirt-engine-sdk-ruby/pull/3/commits/b596b919bc7857fdc0fc1c61a8cb7eab32cfc2db.patch";
559 hash = "sha256-AzGTQaD/e6X4LOMuXhy/WhbayhWKYCGHXPFlzLRWyPM=";
566 nativeBuildInputs = [
573 ] ++ lib.optionals stdenv.isDarwin [ DarwinTools ];
574 buildInputs = [ libdatrie libthai ]
575 ++ lib.optionals stdenv.isLinux [ libselinux libsepol util-linux ];
576 propagatedBuildInputs = [ gobject-introspection wrapGAppsHook gtk2 ];
580 buildInputs = [ curl ];
584 buildInputs = [ libpcap ];
588 # Force pkg-config lookup for libpq.
589 # See https://github.com/ged/ruby-pg/blob/6629dec6656f7ca27619e4675b45225d9e422112/ext/extconf.rb#L34-L55
591 # Note that setting --with-pg-config=${postgresql}/bin/pg_config would add
592 # an unnecessary reference to the entire postgresql package.
593 buildFlags = [ "--with-pg-config=ignore" ];
594 nativeBuildInputs = [ pkg-config ];
595 buildInputs = [ postgresql ];
599 buildInputs = [ libyaml ];
603 buildInputs = [ openssl ];
606 "pygments.rb" = attrs: {
607 buildInputs = [ python3 ];
611 meta.mainProgram = "rackup";
615 meta.mainProgram = "rails";
619 buildInputs = [ rainbow_rake ];
623 buildInputs = [ zeromq czmq ];
624 buildFlags = [ "--with-system-libs" ];
628 if lib.versionOlder spec.version "6.0.0" then {
630 sed -i $(cat $out/nix-support/gem-meta/install-path)/lib/rbnacl.rb -e "2a \
631 RBNACL_LIBSODIUM_GEM_LIB_PATH = '${libsodium.out}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}'
637 substituteInPlace lib/rbnacl/sodium.rb \
638 --replace 'ffi_lib ["sodium"' \
639 'ffi_lib ["${libsodium}/lib/libsodium${stdenv.hostPlatform.extensions.sharedLibrary}"'
644 buildInputs = [ re2 ];
646 "--enable-system-libraries"
650 rest-client = attrs: {
651 meta.mainProgram = "restclient";
655 nativeBuildInputs = [ pkg-config ];
656 buildInputs = [ imagemagick which ];
660 meta.mainProgram = "rougify";
664 buildInputs = [ linux-pam ];
667 rspec-core = attrs: {
668 meta.mainProgram = "rspec";
671 ruby-libvirt = attrs: {
672 nativeBuildInputs = [ pkg-config ];
673 buildInputs = [ libvirt ];
675 "--with-libvirt-include=${libvirt}/include"
676 "--with-libvirt-lib=${libvirt}/lib"
681 buildInputs = [ lxc ];
684 ruby-terminfo = attrs: {
685 buildInputs = [ ncurses ];
687 "--with-cflags=-I${ncurses.dev}/include"
688 "--with-ldflags=-L${ncurses.out}/lib"
692 substituteInPlace extconf.rb --replace 'rubyio.h' 'ruby/io.h'
693 substituteInPlace terminfo.c \
694 --replace 'rubyio.h' 'ruby/io.h' \
695 --replace 'rb_cData' 'rb_cObject'
701 cd "$(cat $out/nix-support/gem-meta/install-path)"
703 substituteInPlace lib/vips.rb \
704 --replace 'library_name("vips", 42)' '"${lib.getLib vips}/lib/libvips${stdenv.hostPlatform.extensions.sharedLibrary}"' \
705 --replace 'library_name("glib-2.0", 0)' '"${glib.out}/lib/libglib-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"' \
706 --replace 'library_name("gobject-2.0", 0)' '"${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"'
711 nativeBuildInputs = [ cmake pkg-config which ] ++ lib.optional stdenv.isDarwin libiconv;
712 buildInputs = [ openssl libssh2 zlib ];
713 dontUseCmakeConfigure = true;
717 nativeBuildInputs = [ rake ];
719 SASS_LIBSASS_PATH = toString libsass;
721 substituteInPlace lib/sassc/native.rb \
722 --replace 'gem_root = spec.gem_dir' 'gem_root = File.join(__dir__, "../../")'
724 } // (lib.optionalAttrs stdenv.isDarwin {
725 # https://github.com/NixOS/nixpkgs/issues/19098
726 buildFlags = [ "--disable-lto" ];
729 sass-embedded = attrs: {
730 # Patch the Rakefile to use our dart-sass and not try to fetch anything.
733 substituteInPlace ext/sass/Rakefile \
734 --replace \'dart-sass/sass\' \'${dart-sass}/bin/sass\' \
735 --replace ' => %w[dart-sass]' ""
739 scrypt = attrs: lib.optionalAttrs stdenv.isDarwin {
742 sed -i -e "s/-arch i386//" Rakefile ext/scrypt/Rakefile
747 buildInputs = [ openssl ];
751 buildInputs = [ postgresql ];
755 buildInputs = [ args.snappy ];
758 sqlite3 = attrs: if lib.versionAtLeast attrs.version "1.5.0"
760 nativeBuildInputs = [ pkg-config ];
761 buildInputs = [ sqlite ];
763 "--enable-system-libraries"
768 "--with-sqlite3-include=${sqlite.dev}/include"
769 "--with-sqlite3-lib=${sqlite.out}/lib"
773 rb-readline = attrs: {
776 substituteInPlace lib/rbreadline.rb \
777 --replace 'infocmp' '${ncurses}/bin/infocmp'
781 taglib-ruby = attrs: {
782 buildInputs = [ taglib ];
785 timfel-krb5-auth = attrs: {
786 buildInputs = [ libkrb5 ];
790 nativeBuildInputs = [ pkg-config openssl ];
791 buildInputs = [ freetds ];
795 meta.mainProgram = "tt";
799 buildInputs = [ curl ];
802 tzinfo = attrs: lib.optionalAttrs (lib.versionAtLeast attrs.version "1.0") {
806 path = if lib.versionAtLeast attrs.version "2.0"
807 then "lib/tzinfo/data_sources/zoneinfo_data_source.rb"
808 else "lib/tzinfo/zoneinfo_data_source.rb";
811 substituteInPlace ${path} \
812 --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
817 buildInputs = [ which libossp_uuid ];
821 meta.mainProgram = "whoisrb";
824 xapian-ruby = attrs: {
825 # use the system xapian
827 nativeBuildInputs = [ rake pkg-config bundler ];
828 buildInputs = [ xapian zlib ];
830 cp ${./xapian-Rakefile} Rakefile
833 export XAPIAN_CONFIG=${xapian}/bin/xapian-config
838 buildInputs = [ zlib ];
842 buildInputs = lib.optionals stdenv.isDarwin [ cctools ];