Commit Graph

25 Commits

Author SHA1 Message Date
Christian Albrecht
8975148a16 vagrant: 1.8.0 -> 1.8.1 2016-01-28 01:01:56 +01:00
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
Arseniy Seroka
87d2532f82 Merge pull request #11879 from aneeshusa/update-vagrant-to-1.8.0
vagrant: 1.7.4 -> 1.8.0
2015-12-22 17:51:35 +03:00
Aneesh Agrawal
53a5a44190 vagrant: 1.7.4 -> 1.8.0 2015-12-22 05:55:48 -05:00
Mathieu Boespflug
bb30c79f0b vagrant: bring embedded/ libraries in scope of dynamic linker. 2015-12-16 18:14:40 +01:00
Tadas Barzdzius
148dcf4d1c Vagrant: 1.7.3 -> 1.7.4 (ZHF) 2015-07-21 19:08:15 +03:00
Tadas Barzdzius
4338031c59 vagrant: 1.7.2 -> 1.7.3 2015-07-12 14:27:17 +03:00
Jascha Geerds
3f66bb7ff2 Add myself as maintainer 2015-06-22 08:26:09 +02:00
Robin Gloster
b88fc6c90e update vagrant to 1.7.2 2015-04-29 13:15:17 +02:00
Shea Levy
2f061ff16b Merge remote-tracking branch 'origin/staging'
Darwin and haskell fixes.
2015-02-17 13:52:37 -05:00
Rob Vermaas
8495c101dc Fixes #6374. Now for real, dohhh. 2015-02-17 13:10:13 +00:00
Rob Vermaas
1a0e6f0039 Fixes #6374. 2015-02-17 13:07:54 +00:00
Eric Seidel
e08b9ab8d3 kill libiconvOr*
Conflicts:
	pkgs/applications/networking/mailreaders/sup/default.nix
	pkgs/development/compilers/ghc/7.8.3-binary.nix
	pkgs/development/interpreters/php/5.3.nix
	pkgs/development/interpreters/ruby/patches.nix
	pkgs/development/libraries/cairo/default.nix
	pkgs/development/libraries/poppler/default.nix
	pkgs/top-level/all-packages.nix
2015-02-07 20:29:28 -08:00
Charles Strahan
145733c479 Merge branch 'master' of github.com:nixos/nixpkgs into pleasant-ruby
Conflicts:
	pkgs/applications/version-management/redmine/default.nix
	pkgs/development/interpreters/ruby/gem.nix
	pkgs/development/interpreters/ruby/generated.nix
	pkgs/development/interpreters/ruby/patches.nix
	pkgs/development/tools/vagrant/default.nix
	pkgs/servers/consul/default.nix
2014-12-28 14:29:52 -05:00
Charles Strahan
bc9934147f fix vagrant 2014-11-18 04:24:07 +00:00
Charles Strahan
cf8f4963a7 rename rubyLibs to rubyPackages 2014-11-09 22:16:58 +00:00
Vladimír Čunát
5b00625aa4 vagrant: use bin/iconv from glibc on Linux
This fixes build after #4419.
2014-11-03 12:58:54 +01:00
Domen Kožar
17a64ccf24 vagrant: fix hash 2014-09-23 00:24:52 +02:00
Rob Vermaas
e94e997786 vagrant: update from 1.6.4 to 1.6.5 2014-09-11 13:32:00 +02:00
Domen Kožar
f9ba413b55 fix eval 2014-09-05 00:06:11 +02:00
Michael Fellinger
f21cccb2b6 vagrant: 1.6.3 -> 1.6.4 2014-09-04 20:24:21 +02:00
Attila Sztupak
84939f1d14 vagrant: upgrade to 1.6.3 2014-07-15 01:53:07 +01:00
Dario Bertini
4247a34463
Updated vagrant to 1.4.3 2014-02-18 15:23:16 +01:00
Jason "Don" O'Conal
2b65900e75 vagrant: update to 1.4.0 2013-12-16 04:50:22 +00:00
Jason "Don" O'Conal
c5bc23a259 vagrant: add expression 2013-11-27 23:05:14 +00:00