ruby: use stdenv derivation for patching RubyGems
Rather than rolling our own. This means that we can use all of the extra functionality stdenv gives us, like being able to provide a list of patches rather than just one.
This commit is contained in:
parent
753e1e0bab
commit
bb4fef1499
|
@ -11,14 +11,7 @@ let
|
||||||
opString = lib.optionalString;
|
opString = 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; };
|
||||||
rubygemsSrc = import ./rubygems-src.nix { inherit fetchurl; };
|
rubygems = import ./rubygems.nix { inherit stdenv lib fetchurl fetchpatch; };
|
||||||
rubygemsPatch = fetchpatch {
|
|
||||||
url = "https://github.com/zimbatm/rubygems/compare/v2.6.6...v2.6.6-nix.patch";
|
|
||||||
sha256 = "0297rdb1m6v75q8665ry9id1s74p9305dv32l95ssf198liaihhd";
|
|
||||||
};
|
|
||||||
unpackdir = obj:
|
|
||||||
lib.removeSuffix ".tgz"
|
|
||||||
(lib.removeSuffix ".tar.gz" obj.name);
|
|
||||||
|
|
||||||
# Contains the ruby version heuristics
|
# Contains the ruby version heuristics
|
||||||
rubyVersion = import ./ruby-version.nix { inherit lib; };
|
rubyVersion = import ./ruby-version.nix { inherit lib; };
|
||||||
|
@ -49,8 +42,10 @@ let
|
||||||
, buildEnv, bundler, bundix
|
, buildEnv, bundler, bundix
|
||||||
, libiconv, libobjc, libunwind, Foundation
|
, libiconv, libobjc, libunwind, Foundation
|
||||||
}:
|
}:
|
||||||
let rubySrc =
|
stdenv.mkDerivation rec {
|
||||||
if useRailsExpress then fetchFromGitHub {
|
name = "ruby-${version}";
|
||||||
|
|
||||||
|
src = if useRailsExpress then fetchFromGitHub {
|
||||||
owner = "ruby";
|
owner = "ruby";
|
||||||
repo = "ruby";
|
repo = "ruby";
|
||||||
rev = tag;
|
rev = tag;
|
||||||
|
@ -59,16 +54,6 @@ let
|
||||||
url = "https://cache.ruby-lang.org/pub/ruby/${ver.majMin}/ruby-${ver}.tar.gz";
|
url = "https://cache.ruby-lang.org/pub/ruby/${ver.majMin}/ruby-${ver}.tar.gz";
|
||||||
sha256 = sha256.src;
|
sha256 = sha256.src;
|
||||||
};
|
};
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
name = "ruby-${version}";
|
|
||||||
|
|
||||||
srcs = [ rubySrc rubygemsSrc ];
|
|
||||||
sourceRoot =
|
|
||||||
if useRailsExpress then
|
|
||||||
rubySrc.name
|
|
||||||
else
|
|
||||||
unpackdir rubySrc;
|
|
||||||
|
|
||||||
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
|
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
|
||||||
NROFF = if docSupport then "${groff}/bin/nroff" else null;
|
NROFF = if docSupport then "${groff}/bin/nroff" else null;
|
||||||
|
@ -100,10 +85,7 @@ let
|
||||||
})."${ver.majMinTiny}";
|
})."${ver.majMinTiny}";
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
cp -r ${unpackdir rubygemsSrc} ${sourceRoot}/rubygems
|
cp -r ${rubygems} $sourceRoot/rubygems
|
||||||
pushd ${sourceRoot}/rubygems
|
|
||||||
patch -p1 < ${rubygemsPatch}
|
|
||||||
popd
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postPatch = if atLeast25 then ''
|
postPatch = if atLeast25 then ''
|
||||||
|
@ -146,6 +128,7 @@ let
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
# Update rubygems
|
# Update rubygems
|
||||||
pushd rubygems
|
pushd rubygems
|
||||||
|
chmod +w bundler/bundler.gemspec
|
||||||
${buildRuby} setup.rb --destdir $GEM_HOME
|
${buildRuby} setup.rb --destdir $GEM_HOME
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
{ fetchurl
|
|
||||||
, version ? "2.7.7"
|
|
||||||
, sha256 ? "1jsmmd31j8j066b83lin4bbqz19jhrirarzb41f3sjhfdjiwkcjc"
|
|
||||||
}:
|
|
||||||
fetchurl {
|
|
||||||
url = "https://rubygems.org/rubygems/rubygems-${version}.tgz";
|
|
||||||
sha256 = sha256;
|
|
||||||
}
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
{ stdenv, lib, fetchurl, fetchpatch }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "rubygems";
|
||||||
|
version = "2.7.7";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://rubygems.org/rubygems/rubygems-${version}.tgz";
|
||||||
|
sha256 = "1jsmmd31j8j066b83lin4bbqz19jhrirarzb41f3sjhfdjiwkcjc";
|
||||||
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/zimbatm/rubygems/compare/v2.6.6...v2.6.6-nix.patch";
|
||||||
|
sha256 = "0297rdb1m6v75q8665ry9id1s74p9305dv32l95ssf198liaihhd";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
cp -r . $out
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Package management framework for Ruby";
|
||||||
|
homepage = https://rubygems.org/;
|
||||||
|
license = with licenses; [ mit /* or */ ruby ];
|
||||||
|
maintainers = with maintainers; [ qyliss zimbatm ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue