ruby-modules: Add new url source type

This just defers to `fetchurl` for fetching.

Additionally, update the `nix-bundle-install.rb` script to handle gems
installed from a path, i.e. those with a `url` source.
Some parts of that script have been disabled in the `path` case
that likely shouldn't be, but cause errors and aren't necessary to get
`vagrant` to work.
This commit is contained in:
Aneesh Agrawal
2018-01-04 07:54:30 -08:00
parent b85c083c99
commit 0750c5aee4
2 changed files with 77 additions and 41 deletions
+18 -7
View File
@@ -65,6 +65,8 @@ let
inherit (attrs.source) url rev sha256 fetchSubmodules;
leaveDotGit = true;
}
else if type == "url" then
fetchurl attrs.source
else
throw "buildRubyGem: don't know how to build a gem of type \"${type}\""
);
@@ -84,7 +86,8 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
buildInputs = [
ruby makeWrapper
] ++ lib.optionals (type == "git") [ git bundler ]
] ++ lib.optionals (type == "git") [ git ]
++ lib.optionals (type != "gem") [ bundler ]
++ lib.optional stdenv.isDarwin darwin.libobjc
++ buildInputs;
@@ -159,14 +162,22 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
echo "buildFlags: $buildFlags"
${lib.optionalString (type == "url") ''
ruby ${./nix-bundle-install.rb} \
"path" \
'${gemName}' \
'${version}' \
'${lib.escapeShellArgs buildFlags}'
''}
${lib.optionalString (type == "git") ''
ruby ${./nix-bundle-install.rb} \
${gemName} \
${attrs.source.url} \
${src} \
${attrs.source.rev} \
${version} \
${lib.escapeShellArgs buildFlags}
"git" \
'${gemName}' \
'${version}' \
'${lib.escapeShellArgs buildFlags}' \
'${attrs.source.url}' \
'${src}' \
'${attrs.source.rev}'
''}
${lib.optionalString (type == "gem") ''