nixpkgs/pkgs/development/interpreters/ruby/gems.nix
2014-10-26 17:34:10 +00:00

97 lines
2.9 KiB
Nix

# is a pretty good interface for calling rubygems
#
# since there are so many rubygems, and we don't want to manage them all,
# proposed design pattern is keep your gem dependencies in a local file
# (hopefully managed with nix-bundle)
#
# use rubyLibs.importGems to call the local file, which has access to all
# the stuff in here
#
# gems here are either super common (rspec) or require patches to work
# properly (libv8)
{ ruby, callPackage, pkgs }:
let
buildRubyGem = callPackage ./gem.nix {};
patches = callPackage ./patches.nix { gems = self; };
lib = ruby.stdenv.lib;
self = rec {
inherit buildRubyGem;
# import an attrset full of gems, then override badly behaved ones
importGems = file: args:
let
builtGems = callPackage file ({ inherit buildRubyGem; rubyLibs = self; } // args);
in lib.mapAttrs (gem: deriv:
if patches ? "${gem}"
then lib.overrideDerivation deriv (oldAttrs:
if oldAttrs ? dontPatch && oldAttrs.dontPatch == 1 then {}
else patches."${gem}")
else deriv) builtGems;
##################################################################
# stuff EVERYONE needs
##################################################################
bundler = buildRubyGem {
name = "bundler-1.6.5";
sha256 = "1s4x0f5by9xs2y24jk6krq5ky7ffkzmxgr4z1nhdykdmpsi2zd0l";
dontPatchShebangs = 1;
checkPhase = ":";
};
rake = buildRubyGem {
name = "rake-10.3.2";
sha256 = "0nvpkjrpsk8xxnij2wd1cdn6arja9q11sxx4aq4fz18bc6fss15m";
gemPath = [ bundler ];
checkPhase = ":";
};
##################################################################
# common dependencies
##################################################################
diff_lcs = buildRubyGem {
name = "diff-lcs-1.2.5";
sha256 = "1vf9civd41bnqi6brr5d9jifdw73j9khc6fkhfl1f8r9cpkdvlx1";
doCheck = false; # check depends on rspec!
};
rspec = rspec_3_0;
rspec_3_0 = buildRubyGem {
name = "rspec-3.0.0";
sha256 = "1x94vk8dlk57clqlyb741y5bsmidp8131wyrb1vh00hi5mdb5szy";
gemPath = [ diff_lcs rspec_core rspec_expectations rspec_mocks rspec_support ];
};
rspec_2_14 = buildRubyGem {
name = "rspec-2.14.1";
sha256 = "134y4wzk1prninb5a0bhxgm30kqfzl8dg06af4js5ylnhv2wd7sg";
};
rspec_core = buildRubyGem {
name = "rspec-core-3.0.3";
sha256 = "0395m5rfpbh87wm3mx549zvm190gikpzyld0xhlr55qwzp6ny97m";
gemPath = [ rspec_support ];
};
rspec_expectations = buildRubyGem {
name = "rspec-expectations-3.0.3";
sha256 = "1mzp3v5r7qy28q8x6dkdib9ymwrxxz81jiq9vfr94jxbmy8rkhn0";
gemPath = [ diff_lcs rspec_support ];
};
rspec_mocks = buildRubyGem {
name = "rspec-mocks-3.0.3";
sha256 = "0svc5wq8k4w8iamj2r7xw4xwhfczcj09s0ps9wz1mmgy9cvn1lj6";
gemPath = [ rspec_support ];
};
rspec_support = buildRubyGem {
name = "rspec-support-3.0.3";
sha256 = "06lxzc4i3cbkm3qc5sdqcg665cyq9hnmmy0qkn355vy4s4vch94l";
};
}; in self