ruby: Fix withPackages on darwin with makeBinaryWrapper
See also https://github.com/NixOS/nixpkgs/pull/161298
This commit is contained in:
parent
851558501d
commit
baf1f1293b
|
@ -3,7 +3,7 @@
|
|||
, zlib, gdbm, ncurses, readline, groff, libyaml, libffi, jemalloc, autoreconfHook, bison
|
||||
, autoconf, libiconv, libobjc, libunwind, Foundation
|
||||
, buildEnv, bundler, bundix
|
||||
, makeWrapper, buildRubyGem, defaultGemConfig, removeReferencesTo
|
||||
, makeBinaryWrapper, buildRubyGem, defaultGemConfig, removeReferencesTo
|
||||
, openssl, openssl_1_1
|
||||
} @ args:
|
||||
|
||||
|
@ -47,7 +47,7 @@ let
|
|||
, autoreconfHook, bison, autoconf
|
||||
, buildEnv, bundler, bundix
|
||||
, libiconv, libobjc, libunwind, Foundation
|
||||
, makeWrapper, buildRubyGem, defaultGemConfig
|
||||
, makeBinaryWrapper, buildRubyGem, defaultGemConfig
|
||||
, baseRuby ? buildPackages.ruby_3_1.override {
|
||||
useRailsExpress = false;
|
||||
docSupport = false;
|
||||
|
@ -245,7 +245,7 @@ let
|
|||
};
|
||||
|
||||
inherit (import ../../ruby-modules/with-packages {
|
||||
inherit lib stdenv makeWrapper buildRubyGem buildEnv;
|
||||
inherit lib stdenv makeBinaryWrapper buildRubyGem buildEnv;
|
||||
gemConfig = defaultGemConfig;
|
||||
ruby = self;
|
||||
}) withPackages buildGems gems;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, lib, buildEnv, buildRubyGem, ruby, gemConfig, makeWrapper }:
|
||||
{ stdenv, lib, buildEnv, buildRubyGem, ruby, gemConfig, makeBinaryWrapper }:
|
||||
|
||||
/*
|
||||
Example usage:
|
||||
|
@ -43,7 +43,7 @@ let
|
|||
|
||||
wrappedRuby = stdenv.mkDerivation {
|
||||
name = "wrapped-${ruby.name}";
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
nativeBuildInputs = [ makeBinaryWrapper ];
|
||||
buildCommand = ''
|
||||
mkdir -p $out/bin
|
||||
for i in ${ruby}/bin/*; do
|
||||
|
@ -54,7 +54,7 @@ let
|
|||
|
||||
in stdenv.mkDerivation {
|
||||
name = "${ruby.name}-with-packages";
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
nativeBuildInputs = [ makeBinaryWrapper ];
|
||||
buildInputs = [ selected ruby ];
|
||||
|
||||
dontUnpack = true;
|
||||
|
|
|
@ -15,6 +15,22 @@ let
|
|||
pkgs.ruby.gems) //
|
||||
(import ./require_exceptions.nix);
|
||||
|
||||
testWrapper = ruby: stdenv.mkDerivation {
|
||||
name = "test-wrappedRuby-${ruby.name}";
|
||||
buildInputs = [ ((ruby.withPackages (ps: [ ])).wrappedRuby) ];
|
||||
buildCommand = ''
|
||||
cat <<'EOF' > test-ruby
|
||||
#!/usr/bin/env ruby
|
||||
puts RUBY_VERSION
|
||||
EOF
|
||||
|
||||
chmod +x test-ruby
|
||||
patchShebangs test-ruby
|
||||
[[ $(./test-ruby) = $(${ruby}/bin/ruby test-ruby) ]]
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
tests = ruby:
|
||||
lib.mapAttrs (name: gem:
|
||||
let
|
||||
|
@ -39,7 +55,7 @@ let
|
|||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "test-all-ruby-gems";
|
||||
buildInputs = builtins.foldl' (sum: ruby: sum ++ ( builtins.attrValues (tests ruby) )) [] rubyVersions;
|
||||
buildInputs = builtins.foldl' (sum: ruby: sum ++ [ (testWrapper ruby) ] ++ ( builtins.attrValues (tests ruby) )) [] rubyVersions;
|
||||
buildCommand = ''
|
||||
touch $out
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue