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 seperates "what to build" (the exact gem versions) from "how to build"
18# (to make gems behave if necessary).
19
20{ lib, fetchurl, writeScript, ruby, kerberos, libxml2, libxslt, python, stdenv, which
21, libiconv, postgresql, v8_3_16_14, clang, sqlite, zlib, imagemagick
22, pkgconfig , ncurses, xapian, gpgme, utillinux, fetchpatch, tzdata, icu, libffi
23, cmake, libssh2, openssl, mysql, darwin, git, perl, gecode_3, curl
24, libmsgpack
25}:
26
27let
28 v8 = v8_3_16_14;
29in
30
31{
32 charlock_holmes = attrs: {
33 buildInputs = [ which icu zlib ];
34 };
35
36 dep-selector-libgecode = attrs: {
37 USE_SYSTEM_GECODE = true;
38 postInstall = ''
39 installPath=$(cat $out/nix-support/gem-meta/install-path)
40 sed -i $installPath/lib/dep-selector-libgecode.rb -e 's@VENDORED_GECODE_DIR =.*@VENDORED_GECODE_DIR = "${gecode_3}"@'
41 '';
42 };
43
44 eventmachine = attrs: {
45 buildInputs = [ openssl ];
46 };
47
48 ffi = attrs: {
49 buildInputs = [ libffi pkgconfig ];
50 };
51
52 gpgme = attrs: {
53 buildInputs = [ gpgme ];
54 };
55
56 # note that you need version >= v3.16.14.8,
57 # otherwise the gem will fail to link to the libv8 binary.
58 # see: https://github.com/cowboyd/libv8/pull/161
59 libv8 = attrs: {
60 buildInputs = [ which v8 python ];
61 buildFlags = [ "--with-system-v8=true" ];
62 };
63
64 msgpack = attrs: {
65 buildInputs = [ libmsgpack ];
66 };
67
68 mysql2 = attrs: {
69 buildInputs = [ mysql.lib zlib openssl ];
70 };
71
72 ncursesw = attrs: {
73 buildInputs = [ ncurses ];
74 buildFlags = [
75 "--with-cflags=-I${ncurses}/include"
76 "--with-ldflags=-L${ncurses}/lib"
77 ];
78 };
79
80 nokogiri = attrs: {
81 buildFlags = [
82 "--use-system-libraries"
83 "--with-zlib-dir=${zlib}"
84 "--with-xml2-lib=${libxml2}/lib"
85 "--with-xml2-include=${libxml2}/include/libxml2"
86 "--with-xslt-lib=${libxslt}/lib"
87 "--with-xslt-include=${libxslt}/include"
88 "--with-exslt-lib=${libxslt}/lib"
89 "--with-exslt-include=${libxslt}/include"
90 ] ++ lib.optional stdenv.isDarwin "--with-iconv-dir=${libiconv}";
91 };
92
93 patron = attrs: {
94 buildInputs = [ curl ];
95 };
96
97 pg = attrs: {
98 buildFlags = [
99 "--with-pg-config=${postgresql}/bin/pg_config"
100 ];
101 };
102
103 puma = attrs: {
104 buildInputs = [ openssl ];
105 };
106
107 rmagick = attrs: {
108 buildInputs = [ imagemagick pkgconfig ];
109 };
110
111 rugged = attrs: {
112 buildInputs = [ cmake pkgconfig openssl libssh2 zlib ];
113 };
114
115 sqlite3 = attrs: {
116 buildFlags = [
117 "--with-sqlite3-include=${sqlite}/include"
118 "--with-sqlite3-lib=${sqlite}/lib"
119 ];
120 };
121
122 sup = attrs: {
123 dontBuild = false;
124 # prevent sup from trying to dynamically install `xapian-ruby`.
125 postPatch = ''
126 cp ${./mkrf_conf_xapian.rb} ext/mkrf_conf_xapian.rb
127
128 substituteInPlace lib/sup/crypto.rb \
129 --replace 'which gpg2' \
130 '${which}/bin/which gpg2'
131 '';
132 };
133
134 timfel-krb5-auth = attrs: {
135 buildInputs = [ kerberos ];
136 };
137
138 therubyracer = attrs: {
139 buildFlags = [
140 "--with-v8-dir=${v8}"
141 "--with-v8-include=${v8}/include"
142 "--with-v8-lib=${v8}/lib"
143 ];
144 };
145
146 tzinfo = attrs: {
147 dontBuild = false;
148 postPatch = ''
149 substituteInPlace lib/tzinfo/zoneinfo_data_source.rb \
150 --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
151 '';
152 };
153
154 xapian-ruby = attrs: {
155 # use the system xapian
156 dontBuild = false;
157 buildInputs = [ xapian pkgconfig zlib ];
158 postPatch = ''
159 cp ${./xapian-Rakefile} Rakefile
160 '';
161 preInstall = ''
162 export XAPIAN_CONFIG=${xapian}/bin/xapian-config
163 '';
164 };
165}
166