nixpkgs/pkgs/development/tools
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
..
activator activator: 1.3.2 -> 1.3.5 2015-07-10 00:23:48 +02:00
alloy Replace 'with plaforms; platform' with 'platforms.platform' 2015-11-17 21:30:43 +01:00
analysis include-what-you-use: use unversioned llvm attribute 2015-12-20 03:22:24 +01:00
apktool apktool: set sourceRoot 2015-07-28 02:55:55 +02:00
boomerang
boost-build
build-managers gradle: 2.9 -> 2.10 2015-12-23 08:44:49 -05:00
casperjs
cdecl
chefdk chefdk: 0.4.0 -> 0.10.0 2015-12-03 13:28:26 -08:00
compass Add compass, stylesheet authoring environment 2015-07-07 12:11:58 +02:00
continuous-integration/jenkins jenkins ci: 1.638 -> 1.643 2015-12-23 15:47:11 +01:00
database sqldeveloper: update to version 4.1.1.19.59 2015-09-10 16:47:43 +02:00
devpi-client devpi-client: init at 2.3.2 2015-12-17 09:34:13 +01:00
documentation Doxygen: fix build on SmartOS 2015-11-16 17:20:14 +01:00
egg2nix
electron xlibs: replace occurrences by xorg 2015-09-15 12:54:34 +02:00
github/github-release github-release: init at 0.6.2 2015-09-08 07:43:41 +02:00
gnulib
godep
grabserial grabserial: drop pythonX.Y- name prefix 2015-09-07 15:54:00 +02:00
guile g-wrap: 1.9.13 -> 1.9.15 2015-07-23 04:13:03 -05:00
haskell cabal2nix: update to version 20151217 2015-12-18 11:37:44 +01:00
heroku heroku: 3.32.0 -> 3.42.20 2015-10-15 20:03:07 +00:00
java Replace 'with plaforms; platform' with 'platforms.platform' 2015-11-17 21:30:43 +01:00
jq jq: build with oniguruma for regex support 2015-11-07 13:54:45 -05:00
libsigrok
libsigrokdecode
literate-programming Merge pull request #10592 from AndersonTorres/eweb 2015-10-25 15:52:06 +01:00
misc Merge master into staging 2015-12-23 18:57:35 +01:00
neoload
node-webkit xlibs: replace occurrences by xorg 2015-09-15 12:54:34 +02:00
ocaml merlin: 2.3 -> 2.3.1 2015-11-28 10:42:08 +01:00
omniorb omniorb: add the expression 2015-07-23 20:42:35 +02:00
packer pidginsipe: add nss and nspr (ZHF) 2015-08-27 12:29:45 +02:00
parse-cli-bin parse: init at 3.0.1 2015-11-09 04:22:34 -05:00
parsing Merge #11067: SmartOS updates 2015-11-23 14:45:44 +01:00
phantomjs
phantomjs2 Add phantomjs2 2015-07-15 21:14:15 +02:00
profiling oprofile: 1.0.0 -> 1.1.0 2015-10-13 13:27:50 +03:00
pydb
quilt
remarshal Replace 'with plaforms; platform' with 'platforms.platform' 2015-11-18 11:34:09 +01:00
rhc rhc: init at 1.36.4 2015-08-13 18:02:55 +02:00
rtags rtags: init at 9fed420 2015-10-18 13:49:23 -07:00
rucksack rucksack: init at 3.1.0 2015-06-20 02:06:20 -07:00
rust rustfmt: 2015-10-28 -> 2015-12-08 2015-12-10 16:23:39 +00:00
sassc sassc: v3.2.4 -> v3.3.2 2015-12-10 17:27:46 -05:00
sauce-connect Replace 'with plaforms; platform' with 'platforms.platform' 2015-11-17 21:30:43 +01:00
selenium xlibs: replace occurrences by xorg 2015-09-15 12:54:34 +02:00
sigrok-cli
slimerjs Force SLimerJS Gecko compatibility even higher 2015-10-13 00:21:44 +03:00
sqsh
sslmate sslmate: make meta.maintainers a list 2015-11-25 23:06:09 +01:00
thrust xlibs: replace occurrences by xorg 2015-09-15 12:54:34 +02:00
toluapp Fixed meta.license: s/licence/license 2015-05-30 15:19:05 +02:00
tradcpp
vagrant ruby: new bundler infrastructure 2015-12-29 09:30:21 -05:00
watchman watchman: 3.0.0 -> 4.1.0 2015-10-23 14:03:30 -04:00
winpdb
yuicompressor