about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters/ruby/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-02-20 12:16:56 +0100
committerAlyssa Ross <hi@alyssa.is>2024-02-20 12:16:56 +0100
commitb24d64b3b1ef897f07cd072a88a9881cb330aa7f (patch)
treea87bb2eed9af3ef1efd51dd65221d91f0c949041 /nixpkgs/pkgs/development/interpreters/ruby/default.nix
parent73338df7473bb3810e70a16b8b0cba4f0f606f2b (diff)
parentfa15b53dbea5028db38d6e09b4cef6eba42aeebb (diff)
downloadnixlib-b24d64b3b1ef897f07cd072a88a9881cb330aa7f.tar
nixlib-b24d64b3b1ef897f07cd072a88a9881cb330aa7f.tar.gz
nixlib-b24d64b3b1ef897f07cd072a88a9881cb330aa7f.tar.bz2
nixlib-b24d64b3b1ef897f07cd072a88a9881cb330aa7f.tar.lz
nixlib-b24d64b3b1ef897f07cd072a88a9881cb330aa7f.tar.xz
nixlib-b24d64b3b1ef897f07cd072a88a9881cb330aa7f.tar.zst
nixlib-b24d64b3b1ef897f07cd072a88a9881cb330aa7f.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/ruby/default.nix')
-rw-r--r--nixpkgs/pkgs/development/interpreters/ruby/default.nix27
1 files changed, 13 insertions, 14 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/ruby/default.nix b/nixpkgs/pkgs/development/interpreters/ruby/default.nix
index 781b3273e3a9..c14cb4648e35 100644
--- a/nixpkgs/pkgs/development/interpreters/ruby/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/ruby/default.nix
@@ -24,7 +24,7 @@ let
     atLeast32 = lib.versionAtLeast ver.majMin "3.2";
     # https://github.com/ruby/ruby/blob/v3_2_2/yjit.h#L21
     yjitSupported = atLeast32 && (stdenv.hostPlatform.isx86_64 || (!stdenv.hostPlatform.isWindows && stdenv.hostPlatform.isAarch64));
-    self = lib.makeOverridable (
+    rubyDrv = lib.makeOverridable (
       { stdenv, buildPackages, lib
       , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
       , rubygemsSupport ? true
@@ -58,7 +58,7 @@ let
         }
       , useBaseRuby ? stdenv.hostPlatform != stdenv.buildPlatform
       }:
-      stdenv.mkDerivation rec {
+      stdenv.mkDerivation ( finalAttrs: {
         pname = "ruby";
         inherit version;
 
@@ -123,8 +123,8 @@ let
         cargoRoot = opString yjitSupport "yjit";
 
         cargoDeps = if yjitSupport then rustPlatform.fetchCargoTarball {
-          inherit src;
-          sourceRoot = "${pname}-${version}/${cargoRoot}";
+          inherit (finalAttrs) src;
+          sourceRoot = "${finalAttrs.pname}-${version}/${finalAttrs.cargoRoot}";
           hash = cargoHash;
         } else null;
 
@@ -175,8 +175,8 @@ let
 
         preInstall = ''
           # Ruby installs gems here itself now.
-          mkdir -pv "$out/${passthru.gemPath}"
-          export GEM_HOME="$out/${passthru.gemPath}"
+          mkdir -pv "$out/${finalAttrs.passthru.gemPath}"
+          export GEM_HOME="$out/${finalAttrs.passthru.gemPath}"
         '';
 
         installFlags = lib.optional docSupport "install-doc";
@@ -205,16 +205,16 @@ let
           sed -i 's/CONFIG\["CC"\] = "\(.*\)"/CONFIG["CC"] = if ENV["CC"].nil? || ENV["CC"].empty? then "\1" else ENV["CC"] end/'  "$rbConfig"
 
           # Remove unnecessary external intermediate files created by gems
-          extMakefiles=$(find $out/${passthru.gemPath} -name Makefile)
+          extMakefiles=$(find $out/${finalAttrs.passthru.gemPath} -name Makefile)
           for makefile in $extMakefiles; do
             make -C "$(dirname "$makefile")" distclean
           done
-          find "$out/${passthru.gemPath}" \( -name gem_make.out -o -name mkmf.log \) -delete
+          find "$out/${finalAttrs.passthru.gemPath}" \( -name gem_make.out -o -name mkmf.log \) -delete
           # Bundler tries to create this directory
           mkdir -p $out/nix-support
           cat > $out/nix-support/setup-hook <<EOF
           addGemPath() {
-            addToSearchPath GEM_PATH \$1/${passthru.gemPath}
+            addToSearchPath GEM_PATH \$1/${finalAttrs.passthru.gemPath}
           }
           addRubyLibPath() {
             addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby
@@ -274,21 +274,20 @@ let
           gemPath = "lib/${rubyEngine}/gems/${ver.libDir}";
           devEnv = import ./dev.nix {
             inherit buildEnv bundler bundix;
-            ruby = self;
+            ruby = finalAttrs.finalPackage;
           };
 
           inherit rubygems;
           inherit (import ../../ruby-modules/with-packages {
             inherit lib stdenv makeBinaryWrapper buildRubyGem buildEnv;
             gemConfig = defaultGemConfig;
-            ruby = self;
+            ruby = finalAttrs.finalPackage;
           }) withPackages buildGems gems;
-
         } // lib.optionalAttrs useBaseRuby {
           inherit baseRuby;
         };
-      }
-    ) args; in self;
+      } )
+    ) args; in rubyDrv;
 
 in {
   mkRubyVersion = rubyVersion;