about summary refs log tree commit diff
path: root/pkgs/development/ruby-modules/gem
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2017-10-05 04:10:57 -0400
committerAneesh Agrawal <aneeshusa@gmail.com>2018-01-04 02:28:33 -0500
commit36f1bcbeb85d8d3447e9a5dadb5801cfe615fded (patch)
tree94302aa0943cc06ca286fb6cfd24f2185fa3217b /pkgs/development/ruby-modules/gem
parent8686b98612dc41d14df2a1f09a313d9084e5f6b6 (diff)
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.
Diffstat (limited to 'pkgs/development/ruby-modules/gem')
-rw-r--r--pkgs/development/ruby-modules/gem/default.nix15
1 files changed, 8 insertions, 7 deletions
diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix
index 62a9d60686f38..eba0dc2c4a7c6 100644
--- a/pkgs/development/ruby-modules/gem/default.nix
+++ b/pkgs/development/ruby-modules/gem/default.nix
@@ -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}
     ''}