ruby: add a new .dev output to ruby derivations

The idea is to bundle ruby, bundler and bundix together. I was
having issues where bundler was installed with ruby 2.3.0 and I wanted to use
ruby 2.0.0.

With this change all the developer has to do is install `ruby_2_0_0.dev`
either in his environment or in a nix-shell.
This commit is contained in:
zimbatm 2016-03-01 20:00:54 +00:00
parent 4637cfa51f
commit 19820e9a96
2 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,7 @@
{ stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub
, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
, autoconf, darwin ? null
, buildEnv, bundler, bundix
} @ args:
let
@ -35,6 +36,7 @@ let
, libffi, fiddleSupport ? true
, autoreconfHook, bison, autoconf
, darwin ? null
, buildEnv, bundler, bundix
}:
let rubySrc =
if useRailsExpress then fetchFromGitHub {
@ -146,11 +148,15 @@ let
};
passthru = rec {
inherit majorVersion minorVersion teenyVersion patchLevel;
inherit majorVersion minorVersion teenyVersion patchLevel version;
rubyEngine = "ruby";
baseRuby = baseruby;
libPath = "lib/${rubyEngine}/${versionNoPatch}";
gemPath = "lib/${rubyEngine}/gems/${versionNoPatch}";
dev = import ./dev.nix {
inherit buildEnv bundler bundix;
ruby = self;
};
};
}
) args; in self;

View File

@ -0,0 +1,24 @@
/* An environment for development that bundles ruby, bundler and bundix
together. This avoids version conflicts where each is using a diferent
version of each-other.
*/
{ buildEnv, ruby, bundler, bundix }:
let
bundler_ = bundler.override {
ruby = ruby;
};
bundix_ = bundix.override {
ruby = ruby;
bundler = bundler_;
};
in
buildEnv {
name = "${ruby.rubyEngine}-dev-${ruby.version}";
paths = [
bundix_
bundler_
ruby
];
pathsToLink = [ "/bin" ];
ignoreCollisions = true;
}