nixpkgs/pkgs/development/interpreters
Charles Strahan b6c06e216b ruby: new bundler infrastructure
This improves our Bundler integration (i.e. `bundlerEnv`).

Before describing the implementation differences, I'd like to point a
breaking change: buildRubyGem now expects `gemName` and `version` as
arguments, rather than a `name` attribute in the form of
"<gem-name>-<version>".

Now for the differences in implementation.

The previous implementation installed all gems at once in a single
derivation. This was made possible by using a set of monkey-patches to
prevent Bundler from downloading gems impurely, and to help Bundler
find and activate all required gems prior to installation. This had
several downsides:

* The patches were really hard to understand, and required subtle
  interaction with the rest of the build environment.
* A single install failure would cause the entire derivation to fail.

The new implementation takes a different approach: we install gems into
separate derivations, and then present Bundler with a symlink forest
thereof. This has a couple benefits over the existing approach:

* Fewer patches are required, with less interplay with the rest of the
  build environment.
* Changes to one gem no longer cause a rebuild of the entire dependency
  graph.
* Builds take 20% less time (using gitlab as a reference).

It's unfortunate that we still have to muck with Bundler's internals,
though it's unavoidable with the way that Bundler is currently designed.
There are a number improvements that could be made in Bundler that would
simplify our packaging story:

* Bundler requires all installed gems reside within the same prefix
  (GEM_HOME), unlike RubyGems which allows for multiple prefixes to
  be specified through GEM_PATH. It would be ideal if Bundler allowed
  for packages to be installed and sourced from multiple prefixes.
* Bundler installs git sources very differently from how RubyGems
  installs gem packages, and, unlike RubyGems, it doesn't provide a
  public interface (CLI or programmatic) to guide the installation of a
  single gem. We are presented with the options of either
  reimplementing a considerable portion Bundler, or patch and use parts
  of its internals; I choose the latter. Ideally, there would be a way
  to install gems from git sources in a manner similar to how we drive
  `gem` to install gem packages.
* When a bundled program is executed (via `bundle exec` or a
  binstub that does `require 'bundler/setup'`), the setup process reads
  the Gemfile.lock, activates the dependencies, re-serializes the lock
  file it read earlier, and then attempts to overwrite the Gemfile.lock
  if the contents aren't bit-identical. I think the reasoning is that
  by merely running an application with a newer version of Bundler, you'll
  automatically keep the Gemfile.lock up-to-date with any changes in the
  format. Unfortunately, that doesn't play well with any form of
  packaging, because bundler will immediately cause the application to
  abort when it attempts to write to the read-only Gemfile.lock in the
  store. We work around this by normalizing the Gemfile.lock with the
  version of Bundler that we'll use at runtime before we copy it into
  the store. This feels fragile, but it's the best we can do without
  changes upstream, or resorting to more delicate hacks.

With all of the challenges in using Bundler, one might wonder why we
can't just cut Bundler out of the picture and use RubyGems. After all,
Nix provides most of the isolation that Bundler is used for anyway.

The problem, however, is that almost every Rails application calls
`Bundler::require` at startup (by way of the default project templates).
Because bundler will then, by default, `require` each gem listed in the
Gemfile, Rails applications are almost always written such that none of
the source files explicitly require their dependencies. That leaves us
with two options: support and use Bundler, or maintain massive patches
for every Rails application that we package.

Closes #8612
2015-12-29 09:30:21 -05:00
..
acl2 Adopt fix from ewemoa to give more memory to acl2 build 2014-09-20 12:13:43 +04:00
angelscript Angelscript: update 2.30.0 -> 2.30.1 2015-07-05 00:32:53 +03:00
ceptre ceptre: 2015-08-30 -> 2015-11-20 2015-11-22 14:24:24 +01:00
chibi chibi: Add missing meta.license field. 2014-09-04 17:05:20 +02:00
clisp Add clisp 2.33.2 — for testing SBCL bootstrap 2014-10-18 19:52:59 +04:00
clojure clojure: 1.6.0 -> 1.7.0 2015-10-27 08:11:37 +01:00
dart rename all occurrences of stdenv.cc.gcc to stdenv.cc.cc 2015-01-14 20:27:55 -08:00
eff Added eff-20140928 2014-10-28 17:21:55 +01:00
elixir elixir: 1.0.5 -> 1.1.1 2015-09-29 13:10:39 +02:00
erlang erlangR18: 18.0 -> 18.2 2015-12-17 09:01:49 +09:00
falcon falcon: update to lastest git revision as the lastest release does not build 2014-09-23 23:52:18 +02:00
gnu-apl gnuapl: latest version doesn't require liblapack 2015-06-11 22:00:13 -05:00
groovy groovy: 2.4.3 -> 2.4.5 and wrap correctly 2015-11-05 20:37:08 +01:00
gtk-server gtk-server: add myself as a maintainer 2015-11-26 08:24:02 +01:00
guile Merge recent master into staging 2014-11-05 15:00:44 +01:00
hugs hugs: set meta.platforms 2015-05-15 21:26:10 +02:00
io Update Io lang to version 2013.12.04 2014-01-14 15:07:31 +01:00
j j: re-implement using mkDerivation 2015-03-24 14:05:25 +01:00
jimtcl Merge recent master into staging 2014-09-13 21:48:29 +02:00
jruby jruby: update 1.7.20.1 -> 1.7.21 2015-07-08 21:38:00 -05:00
jython Add jython 2015-04-24 10:44:33 +01:00
kona kona: bump to 3.21 2015-03-27 19:33:59 +01:00
lolcode LOLcode(version 0.10.5): New Package 2015-02-15 08:58:42 -02:00
love Turn some license strings into lib.licenses values 2014-07-28 11:31:14 +02:00
lua-4 Lua4: adds branch information 2015-01-15 10:28:40 +01:00
lua-5 Adding Lua 5.3, seems to work 2015-06-02 20:32:12 +03:00
luajit nixpkgs: luajit 2.0.3 -> 2.0.4 2015-05-27 16:36:27 -05:00
lush Update lush 2015-04-05 20:27:25 +03:00
maude Fix many package descriptions 2014-08-24 22:31:37 +02:00
mujs musj: 2015-09-15 -> 2015-09-29 2015-10-06 16:29:05 +02:00
nix-exec nix-exec: 4.1.2 -> 4.1.3 bugfix release 2015-11-20 09:16:35 -05:00
octave octave: build with openblas 2015-06-07 14:16:37 -05:00
perl Merge branch 'master' into staging 2015-12-05 11:42:48 +01:00
php php: 7.0.0 -> 7.0.1 2015-12-18 09:41:51 +01:00
picoc Replace 'with plaforms; platform' with 'platforms.platform' 2015-11-17 21:30:43 +01:00
picolisp picolisp: 3.1.11 -> 15.11 2015-11-26 08:24:02 +01:00
pure pure: fixed build with gcc 4.9 (ZHF) 2015-07-09 13:52:26 +02:00
pypy pypy: 4.0.0 -> 4.0.1 2015-12-01 11:45:13 +01:00
pyrex Fix Pyrex build 2012-07-18 09:50:36 -04:00
python python35: 3.5.0 -> 3.5.1 2015-12-08 04:35:17 +01:00
racket racket: don't build docs as it causes failures sometimes 2015-09-02 21:16:20 +02:00
rakudo rakudo: 2014.04 -> 2015.03 2015-04-03 23:18:35 -05:00
rascal Drop unnecessary setting of java.home 2014-01-25 03:04:46 +01:00
regina Update Regina/REXX 2015-05-10 13:46:30 +02:00
renpy Turn some license strings into lib.licenses values 2014-07-28 11:31:14 +02:00
ruby ruby: new bundler infrastructure 2015-12-29 09:30:21 -05:00
scheme48 Add myself as a maintainer to a bunch of packages. 2014-09-04 17:05:21 +02:00
scsh scsh: 0.6.7 -> 0.7 pre-release 2015-07-21 11:34:13 +02:00
self xlibs: replace occurrences by xorg 2015-09-15 12:54:34 +02:00
spidermonkey spidermonkey: add 31.5 2015-09-08 17:00:34 -07:00
supercollider supercollider: build with gcc48 (ZHF) 2015-07-30 13:09:58 +02:00
tcl tcl/tk: Refactor and add maintainers 2015-04-30 18:49:27 -07:00
xulrunner xulrunner: fix path to configure script 2015-11-08 22:12:06 +01:00