summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2016-03-01 20:00:54 +0000
committerzimbatm <zimbatm@zimbatm.com>2016-03-14 22:25:48 +0000
commit19820e9a9633e68b72e27f173d7b367a99577655 (patch)
tree49043c85cf4074ca102f64e003fca6338c765f29 /pkgs/development
parent4637cfa51f141dfc6daa3d7c4b3d9c12c7c40706 (diff)
downloadnixlib-19820e9a9633e68b72e27f173d7b367a99577655.tar
nixlib-19820e9a9633e68b72e27f173d7b367a99577655.tar.gz
nixlib-19820e9a9633e68b72e27f173d7b367a99577655.tar.bz2
nixlib-19820e9a9633e68b72e27f173d7b367a99577655.tar.lz
nixlib-19820e9a9633e68b72e27f173d7b367a99577655.tar.xz
nixlib-19820e9a9633e68b72e27f173d7b367a99577655.tar.zst
nixlib-19820e9a9633e68b72e27f173d7b367a99577655.zip
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.
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/interpreters/ruby/default.nix8
-rw-r--r--pkgs/development/interpreters/ruby/dev.nix24
2 files changed, 31 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 2085d558df5f..2ff960f6fcc6 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -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;
diff --git a/pkgs/development/interpreters/ruby/dev.nix b/pkgs/development/interpreters/ruby/dev.nix
new file mode 100644
index 000000000000..7787306eb324
--- /dev/null
+++ b/pkgs/development/interpreters/ruby/dev.nix
@@ -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;
+}