ruby treewide: don't merge source into top-level

Keep the `source` attrset distinct to prevent its entries from merging
with the top level attrs.
Since each type of source has a different set of entries for `source`,
this is the easiest way to keep them together.
This will pave the way for a new `url` type of source.

This is a mass-rebuild of many ruby packages,
notably those using `git` type sources.
This commit is contained in:
Aneesh Agrawal
2017-10-05 04:10:57 -04:00
parent 8686b98612
commit 36f1bcbeb8
8 changed files with 20 additions and 18 deletions

View File

@@ -67,8 +67,10 @@ rec {
};
in res;
composeGemAttrs = ruby: gems: name: attrs: ((removeAttrs attrs ["source" "platforms"]) // attrs.source // {
composeGemAttrs = ruby: gems: name: attrs: ((removeAttrs attrs ["platforms"]) // {
inherit ruby;
inherit (attrs.source) type;
source = removeAttrs attrs.source ["type"];
gemName = name;
gemPath = map (gemName: gems."${gemName}") (attrs.dependencies or []);
});

View File

@@ -5,7 +5,7 @@ buildRubyGem rec {
name = "${gemName}-${version}";
gemName = "bundler";
version = "1.14.6";
sha256 = "0h3x2csvlz99v2ryj1w72vn6kixf7rl35lhdryvh7s49brnj0cgl";
source.sha256 = "0h3x2csvlz99v2ryj1w72vn6kixf7rl35lhdryvh7s49brnj0cgl";
dontPatchShebangs = true;
postFixup = ''

View File

@@ -31,8 +31,7 @@ let
rainbow_rake = buildRubyGem {
name = "rake";
gemName = "rake";
remotes = ["https://rubygems.org"];
sha256 = "01j8fc9bqjnrsxbppncai05h43315vmz9fwg28qdsgcjw9ck1d7n";
source.sha256 = "01j8fc9bqjnrsxbppncai05h43315vmz9fwg28qdsgcjw9ck1d7n";
type = "gem";
version = "12.0.0";
};

View File

@@ -41,7 +41,6 @@ lib.makeOverridable (
, patches ? []
, gemPath ? []
, dontStrip ? true
, remotes ? ["https://rubygems.org"]
# Assume we don't have to build unless strictly necessary (e.g. the source is a
# git checkout).
# If you need to apply patches, make sure to set `dontBuild = false`;
@@ -56,12 +55,14 @@ let
src = attrs.src or (
if type == "gem" then
fetchurl {
urls = map (remote: "${remote}/gems/${gemName}-${version}.gem") remotes;
inherit (attrs) sha256;
urls = map (
remote: "${remote}/gems/${gemName}-${version}.gem"
) (attrs.source.remotes or [ "https://rubygems.org" ]);
inherit (attrs.source) sha256;
}
else if type == "git" then
fetchgit {
inherit (attrs) url rev sha256 fetchSubmodules;
inherit (attrs.source) url rev sha256 fetchSubmodules;
leaveDotGit = true;
}
else
@@ -74,7 +75,7 @@ let
in
stdenv.mkDerivation (attrs // {
stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
inherit ruby;
inherit doCheck;
inherit dontBuild;
@@ -161,9 +162,9 @@ stdenv.mkDerivation (attrs // {
${lib.optionalString (type == "git") ''
ruby ${./nix-bundle-install.rb} \
${gemName} \
${attrs.url} \
${attrs.source.url} \
${src} \
${attrs.rev} \
${attrs.source.rev} \
${version} \
${lib.escapeShellArgs buildFlags}
''}