about summary refs log tree commit diff
path: root/pkgs/development/ruby-modules
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-07-07 06:01:26 +0000
committerGitHub <noreply@github.com>2023-07-07 06:01:26 +0000
commitcdb00fdc73710619ee12b33894fdb073481ee5ca (patch)
tree5e65c1ac44d2af24478ef0ef2e09a77e5a564ecc /pkgs/development/ruby-modules
parentc0f0122ec54ded86155ed878777af128ba21d0bd (diff)
parentc63bad16180a55d3b04bdfba5a7830d55db9bb63 (diff)
Merge master into staging-next
Diffstat (limited to 'pkgs/development/ruby-modules')
-rw-r--r--pkgs/development/ruby-modules/bundled-common/default.nix5
-rw-r--r--pkgs/development/ruby-modules/bundler-app/default.nix5
-rw-r--r--pkgs/development/ruby-modules/gem/default.nix11
3 files changed, 17 insertions, 4 deletions
diff --git a/pkgs/development/ruby-modules/bundled-common/default.nix b/pkgs/development/ruby-modules/bundled-common/default.nix
index aa903a5637c08..b18248c7d61b8 100644
--- a/pkgs/development/ruby-modules/bundled-common/default.nix
+++ b/pkgs/development/ruby-modules/bundled-common/default.nix
@@ -56,9 +56,9 @@ let
   else
     let
       gem = gems.${pname};
-      version = gem.version;
+      suffix = gem.suffix;
     in
-      "${pname}-${version}";
+      "${pname}-${suffix}";
 
   pname' = if pname != null then
     pname
@@ -118,6 +118,7 @@ let
 
     passthru = rec {
       inherit ruby bundler gems confFiles envPaths;
+      inherit (gems.${pname}) gemType;
 
       wrappedRuby = stdenv.mkDerivation {
         name = "wrapped-ruby-${pname'}";
diff --git a/pkgs/development/ruby-modules/bundler-app/default.nix b/pkgs/development/ruby-modules/bundler-app/default.nix
index 5bb9e47cf5a68..01e90ba53f1ff 100644
--- a/pkgs/development/ruby-modules/bundler-app/default.nix
+++ b/pkgs/development/ruby-modules/bundler-app/default.nix
@@ -68,7 +68,10 @@ in
     ${lib.optionalString installManpages ''
     for section in {1..9}; do
       mandir="$out/share/man/man$section"
-      find -L ${basicEnv}/${ruby.gemPath}/gems/${basicEnv.name} \( -wholename "*/man/*.$section" -o -wholename "*/man/man$section/*.$section" \) -print -execdir mkdir -p $mandir \; -execdir cp '{}' $mandir \;
+
+      # See: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/ruby-modules/gem/default.nix#L184-L200
+      # See: https://github.com/rubygems/rubygems/blob/7a7b234721c375874b7e22b1c5b14925b943f04e/bundler/lib/bundler.rb#L285-L291
+      find -L ${basicEnv}/${ruby.gemPath}/${lib.optionalString (basicEnv.gemType == "git" || basicEnv.gemType == "url") "bundler/"}gems/${basicEnv.name} \( -wholename "*/man/*.$section" -o -wholename "*/man/man$section/*.$section" \) -print -execdir mkdir -p $mandir \; -execdir cp '{}' $mandir \;
     done
     ''}
   ''
diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix
index 7105663413a2b..b33758486eed1 100644
--- a/pkgs/development/ruby-modules/gem/default.nix
+++ b/pkgs/development/ruby-modules/gem/default.nix
@@ -75,6 +75,14 @@ let
     else
       throw "buildRubyGem: don't know how to build a gem of type \"${type}\""
   );
+
+  # See: https://github.com/rubygems/rubygems/blob/7a7b234721c375874b7e22b1c5b14925b943f04e/bundler/lib/bundler/source/git.rb#L103
+  suffix =
+    if type == "git" then
+      builtins.substring 0 12 attrs.source.rev
+    else
+      version;
+
   documentFlag =
     if document == []
     then "-N"
@@ -86,6 +94,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
   inherit ruby;
   inherit dontBuild;
   inherit dontStrip;
+  inherit suffix;
   gemType = type;
 
   nativeBuildInputs = [
@@ -100,7 +109,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
     ++ buildInputs;
 
   #name = builtins.trace (attrs.name or "no attr.name" ) "${namePrefix}${gemName}-${version}";
-  name = attrs.name or "${namePrefix}${gemName}-${version}";
+  name = attrs.name or "${namePrefix}${gemName}-${suffix}";
 
   inherit src;