re-indent; make rubies overridable
This commit is contained in:
parent
99a66bc2f9
commit
1223210576
@ -1,14 +1,7 @@
|
|||||||
{ stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub
|
{ stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub
|
||||||
, zlib, zlibSupport ? true
|
, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
|
||||||
, openssl, opensslSupport ? true
|
, autoconf, darwin ? null
|
||||||
, gdbm, gdbmSupport ? true
|
} @ args:
|
||||||
, ncurses, readline, cursesSupport ? true
|
|
||||||
, groff, docSupport ? false
|
|
||||||
, libyaml, yamlSupport ? true
|
|
||||||
, libffi, fiddleSupport ? true
|
|
||||||
, autoreconfHook, bison, autoconf
|
|
||||||
, darwin ? null
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
op = stdenv.lib.optional;
|
op = stdenv.lib.optional;
|
||||||
@ -16,30 +9,43 @@ let
|
|||||||
opString = stdenv.lib.optionalString;
|
opString = stdenv.lib.optionalString;
|
||||||
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
|
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
|
||||||
config = import ./config.nix { inherit fetchFromSavannah; };
|
config = import ./config.nix { inherit fetchFromSavannah; };
|
||||||
generic = { majorVersion, minorVersion, teenyVersion, patchLevel, sha256 } @ args:
|
|
||||||
let
|
generic = { majorVersion, minorVersion, teenyVersion, patchLevel, sha256 }: let
|
||||||
versionNoPatch = "${majorVersion}.${minorVersion}.${teenyVersion}";
|
versionNoPatch = "${majorVersion}.${minorVersion}.${teenyVersion}";
|
||||||
isRuby21 = majorVersion == "2" && minorVersion == "1";
|
version = "${versionNoPatch}-p${patchLevel}";
|
||||||
isRuby18 = majorVersion == "1" && minorVersion == "8";
|
fullVersionName = if patchLevel != "0" && stdenv.lib.versionOlder versionNoPatch "2.1"
|
||||||
baseruby = self false;
|
then version
|
||||||
self = useRailsExpress: stdenv.mkDerivation rec {
|
else versionNoPatch;
|
||||||
version = "${versionNoPatch}-p${patchLevel}";
|
tag = "v" + stdenv.lib.replaceChars ["." "p" "-"] ["_" "_" ""] fullVersionName;
|
||||||
|
isRuby21 = majorVersion == "2" && minorVersion == "1";
|
||||||
|
isRuby18 = majorVersion == "1" && minorVersion == "8";
|
||||||
|
baseruby = self.override { useRailsExpress = false; };
|
||||||
|
self = lib.makeOverridable (
|
||||||
|
{ stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub
|
||||||
|
, useRailsExpress ? true
|
||||||
|
, zlib, zlibSupport ? true
|
||||||
|
, openssl, opensslSupport ? true
|
||||||
|
, gdbm, gdbmSupport ? true
|
||||||
|
, ncurses, readline, cursesSupport ? true
|
||||||
|
, groff, docSupport ? false
|
||||||
|
, libyaml, yamlSupport ? true
|
||||||
|
, libffi, fiddleSupport ? true
|
||||||
|
, autoreconfHook, bison, autoconf
|
||||||
|
, darwin ? null
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
inherit version;
|
||||||
|
|
||||||
name = "ruby-${version}";
|
name = "ruby-${version}";
|
||||||
|
|
||||||
src = let
|
src = if useRailsExpress then fetchFromGitHub {
|
||||||
versionName = if patchLevel != "0" && stdenv.lib.versionOlder versionNoPatch "2.1"
|
|
||||||
then version
|
|
||||||
else versionNoPatch;
|
|
||||||
tag = "v" + stdenv.lib.replaceChars ["." "p" "-"] ["_" "_" ""] versionName;
|
|
||||||
in if useRailsExpress then fetchFromGitHub {
|
|
||||||
owner = "ruby";
|
owner = "ruby";
|
||||||
repo = "ruby";
|
repo = "ruby";
|
||||||
rev = tag;
|
rev = tag;
|
||||||
sha256 = args.sha256.git;
|
sha256 = sha256.git;
|
||||||
} else fetchurl {
|
} else fetchurl {
|
||||||
url = "http://cache.ruby-lang.org/pub/ruby/${majorVersion}.${minorVersion}/ruby-${versionName}.tar.gz";
|
url = "http://cache.ruby-lang.org/pub/ruby/${majorVersion}.${minorVersion}/ruby-${fullVersionName}.tar.gz";
|
||||||
sha256 = args.sha256.src;
|
sha256 = sha256.src;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
|
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
|
||||||
@ -104,7 +110,7 @@ let
|
|||||||
|
|
||||||
envHooks+=(addGemPath)
|
envHooks+=(addGemPath)
|
||||||
EOF
|
EOF
|
||||||
'' + lib.optionalString useRailsExpress ''
|
'' + opString useRailsExpress ''
|
||||||
rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
|
rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
|
||||||
|
|
||||||
# Prevent the baseruby from being included in the closure.
|
# Prevent the baseruby from being included in the closure.
|
||||||
@ -126,7 +132,8 @@ let
|
|||||||
libPath = "lib/${versionNoPatch}";
|
libPath = "lib/${versionNoPatch}";
|
||||||
gemPath = "lib/${rubyEngine}/gems/${versionNoPatch}";
|
gemPath = "lib/${rubyEngine}/gems/${versionNoPatch}";
|
||||||
};
|
};
|
||||||
}; in self true;
|
}
|
||||||
|
) args; in self;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
ruby_1_8_7 = generic {
|
ruby_1_8_7 = generic {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user