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, qt48
25}:
26
27let
28 v8 = v8_3_16_14;
29in
30
31{
32 bundler = attrs:
33 let
34 templates = "${attrs.ruby.gemPath}/gems/${attrs.gemName}-${attrs.version}/lib/bundler/templates/";
35 in {
36 # patching shebangs would fail on the templates/Executable file, so we
37 # temporarily remove the executable flag.
38 preFixup = "chmod -x $out/${templates}/Executable";
39 postFixup = ''
40 chmod +x $out/${templates}/Executable
41
42 # Allows to load another bundler version
43 sed -i -e "s/activate_bin_path/bin_path/g" $out/bin/bundle
44 '';
45 };
46
47 capybara-webkit = attrs: {
48 buildInputs = [ qt48 ];
49 };
50
51 charlock_holmes = attrs: {
52 buildInputs = [ which icu zlib ];
53 };
54
55 dep-selector-libgecode = attrs: {
56 USE_SYSTEM_GECODE = true;
57 postInstall = ''
58 installPath=$(cat $out/nix-support/gem-meta/install-path)
59 sed -i $installPath/lib/dep-selector-libgecode.rb -e 's@VENDORED_GECODE_DIR =.*@VENDORED_GECODE_DIR = "${gecode_3}"@'
60 '';
61 };
62
63 eventmachine = attrs: {
64 buildInputs = [ openssl ];
65 };
66
67 ffi = attrs: {
68 buildInputs = [ libffi pkgconfig ];
69 };
70
71 gpgme = attrs: {
72 buildInputs = [ gpgme ];
73 };
74
75 hitimes = attrs: {
76 buildInputs =
77 stdenv.lib.optionals stdenv.isDarwin
78 [ darwin.apple_sdk.frameworks.CoreServices ];
79 };
80
81 # note that you need version >= v3.16.14.8,
82 # otherwise the gem will fail to link to the libv8 binary.
83 # see: https://github.com/cowboyd/libv8/pull/161
84 libv8 = attrs: {
85 buildInputs = [ which v8 python ];
86 buildFlags = [ "--with-system-v8=true" ];
87 };
88
89 msgpack = attrs: {
90 buildInputs = [ libmsgpack ];
91 };
92
93 mysql2 = attrs: {
94 buildInputs = [ mysql.lib zlib openssl ];
95 };
96
97 ncursesw = attrs: {
98 buildInputs = [ ncurses ];
99 buildFlags = [
100 "--with-cflags=-I${ncurses.dev}/include"
101 "--with-ldflags=-L${ncurses.out}/lib"
102 ];
103 };
104
105 nokogiri = attrs: {
106 buildFlags = [
107 "--use-system-libraries"
108 "--with-zlib-dir=${zlib.dev}"
109 "--with-xml2-lib=${libxml2.out}/lib"
110 "--with-xml2-include=${libxml2.dev}/include/libxml2"
111 "--with-xslt-lib=${libxslt.out}/lib"
112 "--with-xslt-include=${libxslt.dev}/include"
113 "--with-exslt-lib=${libxslt.out}/lib"
114 "--with-exslt-include=${libxslt.dev}/include"
115 ] ++ lib.optional stdenv.isDarwin "--with-iconv-dir=${libiconv}";
116 };
117
118 patron = attrs: {
119 buildInputs = [ curl ];
120 };
121
122 pg = attrs: {
123 buildFlags = [
124 "--with-pg-config=${postgresql}/bin/pg_config"
125 ];
126 };
127
128 puma = attrs: {
129 buildInputs = [ openssl ];
130 };
131
132 rmagick = attrs: {
133 buildInputs = [ imagemagick pkgconfig which ];
134 };
135
136 rugged = attrs: {
137 buildInputs = [ cmake pkgconfig openssl libssh2 zlib ];
138 };
139
140 sqlite3 = attrs: {
141 buildFlags = [
142 "--with-sqlite3-include=${sqlite.dev}/include"
143 "--with-sqlite3-lib=${sqlite.out}/lib"
144 ];
145 };
146
147 sup = attrs: {
148 dontBuild = false;
149 # prevent sup from trying to dynamically install `xapian-ruby`.
150 postPatch = ''
151 cp ${./mkrf_conf_xapian.rb} ext/mkrf_conf_xapian.rb
152
153 substituteInPlace lib/sup/crypto.rb \
154 --replace 'which gpg2' \
155 '${which}/bin/which gpg2'
156 '';
157 };
158
159 timfel-krb5-auth = attrs: {
160 buildInputs = [ kerberos ];
161 };
162
163 therubyracer = attrs: {
164 buildFlags = [
165 "--with-v8-dir=${v8}"
166 "--with-v8-include=${v8}/include"
167 "--with-v8-lib=${v8}/lib"
168 ];
169 };
170
171 typhoeus = attrs: {
172 buildInputs = [ curl ];
173 };
174
175 tzinfo = attrs: {
176 dontBuild = false;
177 postPatch = ''
178 substituteInPlace lib/tzinfo/zoneinfo_data_source.rb \
179 --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
180 '';
181 };
182
183 xapian-ruby = attrs: {
184 # use the system xapian
185 dontBuild = false;
186 buildInputs = [ xapian pkgconfig zlib ];
187 postPatch = ''
188 cp ${./xapian-Rakefile} Rakefile
189 '';
190 preInstall = ''
191 export XAPIAN_CONFIG=${xapian}/bin/xapian-config
192 '';
193 };
194
195}
196