[Nix-dev] ANN: Ruby packaging changes coming soon

Charles Strahan charles at cstrahan.com
Mon Jul 6 07:07:07 CEST 2015


Hello all,

In the next day or two, I intend to merge this PR:
https://github.com/NixOS/nixpkgs/pull/8612

This will greatly improve the way we handle Ruby/Bundler packages.

Before I introduce the benefits, I'd like to draw attention to a
breaking change: you should now pass `gemName` and `version` to
`buildRubyGem`, instead of passing `name`. For example:

  buildRubyGem {
    name = "some-name"; # name now specifies the drv name,
                        # which defaults to
                        <ruby-name>-<gem-name>-<version>
    gemName = "some-gem";
    version = "1.2.3";
    sha256  = "08p5gx18yrbnwc6xc0mxvsfaxzgy2y9i78xq7ds0qmdm67q39y4z";
    gemPath = [ /* other gem deps go here */ ];
  }

Now, on to the bundlerEnv improvements.

These changes greatly simplify things over the existing approach. A lot
of grossness originally came from the fact that Bundler _requires_ a
single prefix in order to function. So, I originally wrote enough hacks
and monkey-patches to get Bundler to install all gems in one go,
patching over internals to prevent Bundler from trying to reach out to
the internet (Bundler has practically no useful, public, stable API, so
patching is the only way to go). The hacks I wrote were incredibly ugly
and hard to follow, and they've weighed considerably on my conscience
for quite some time.

Going forward, we'll have a much, much smaller set of patches to get
Bundler to install into individual prefixes, and then we create a
symlink forest at the very end to appease Bundler. Even with a little
extra added documentation, the diff still comes out with fewer lines
added than removed, and (I think) the implementation is a little less
bat-shit-crazy.

-Charles


More information about the nix-dev mailing list