Commit Graph

27 Commits

Author SHA1 Message Date
Nikolay Amiantov
9b980baa9d bundlerEnv.wrapper: rename to wrappedRuby 2016-01-24 15:59:31 +03:00
Nikolay Amiantov
75358ad0e7 bundlerEnv: add wrapper 2016-01-10 07:26:37 +03: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
0c05f14d53 Merge pull request #10535 from roblabla/feature-updateGitlab8.0.5
gitlab: 7.4.2 -> 8.0.5
2015-12-04 16:30:09 +03:00
roblabla
b7a4231aa2 gitlab: 7.4.2 -> 8.0.5 2015-12-04 01:14:24 +01:00
zimbatm
ad2a4ab24c ruby: remove insecure 1.8.7, fixes #11194
1.8.x is unsupported and is probably insecure.

This also simplifies things a little bit
2015-11-25 12:10:03 +01:00
William A. Kennington III
6602f49495 Revert "Revert "Merge pull request #9543 from NixOS/staging.post-15.06""
This reverts commit 741bf840da.

This reverts the fallout from reverting the major changes.
2015-11-14 12:32:51 -08:00
Eelco Dolstra
741bf840da Revert "Merge pull request #9543 from NixOS/staging.post-15.06"
This reverts commit f61176c539, reversing
changes made to a27ca029ee.

Conflicts:
	pkgs/development/libraries/ncurses/default.nix
2015-10-06 15:24:20 +02:00
Jude Taylor
83a5cfb260 add darwin.libobjc to some ruby gems that need it 2015-10-01 13:30:30 -07:00
William A. Kennington III
0a7176c5a1 Revert "bundlerEnv: Use released versions of bundler"
This reverts commit 7bc8b1561e.

This breaks some ruby gems and needs to be reworked again.
2015-09-20 22:05:29 -07:00
William A. Kennington III
7bc8b1561e bundlerEnv: Use released versions of bundler
We were using HEAD for unreleased features. These features are now in
release builds so we should go back to using those. This also means we
won't have to deal with hash mismatches for all ruby packages.
2015-09-20 18:56:56 -07:00
William A. Kennington III
dae5b35463 ruby: Fixup libv8 versions 2015-07-08 15:10:50 -07:00
Charles Strahan
09602f7f39 ruby: fix gems that use mysql 2015-04-27 22:00:52 -04:00
Charles Strahan
7fc3b002e6 bundlerEnv: better error handling
properly handle the case where a gemspec is missing
2015-04-15 19:24:30 -04:00
Charles Strahan
be3d3dd298 bundlerEnv: fix charlock_holmes config 2015-04-15 19:24:04 -04:00
William A. Kennington III
a604b42480 mysql: Use libs in place of the binary mysql 2015-04-01 16:46:53 -07:00
Eelco Dolstra
0e2257966f Disable packages that depend on <nixpkgs>
Nothing in Nixpkgs should use <nixpkgs>, because it can cause Nixpkgs
evaluation to depend in part on a different version of Nixpkgs,
leading to unpredictable results (including evaluation errors).
2015-03-27 16:17:48 +01:00
Jaka Hudoklin
17b9405685 bundlerEnv: add support for additional build inputs 2015-03-18 14:15:50 +01:00
Nikolay Amiantov
0deb3fce70 bundler-env: add .env 2015-02-04 19:42:40 +03:00
Charles Strahan
6eaa419920 gitlab: fix evaluation 2015-01-25 16:28:18 -05:00
Charles Strahan
989a894fc8 ruby: patch path in tzdata gem 2015-01-25 16:22:30 -05:00
Charles Strahan
c1814073ac bundlerEnv: use full path to ruby in wrappers 2015-01-24 17:35:11 -05:00
Charles Strahan
98bfaf52f7 ruby: use commit to identify libv8 patch 2015-01-22 00:47:08 -05:00
Charles Strahan
034488ec80 ruby: fixup mpdcron 2015-01-21 22:38:29 -05:00
Charles Strahan
8085f088cb ruby: exorcise the last few remaining rubyPackages 2015-01-21 22:23:37 -05:00
Charles Strahan
65c7c61841 ruby: use patch for libv8 2015-01-21 20:37:05 -05:00
Charles Strahan
317d78d145 consule: use new bundlerEnv 2015-01-21 20:33:19 -05:00