Merge pull request #161298 from bergkvist/macos-shebang

ruby-modules/bundler-env: Replace makeWrapper with makeBinaryWrapper to make bundled ruby apps work on macOS
This commit is contained in:
Robert Hensing 2022-03-10 00:06:08 +01:00 committed by GitHub
commit 09477e8a64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
{ stdenv, runCommand, ruby, lib, rsync
, defaultGemConfig, buildRubyGem, buildEnv
, makeWrapper
, makeBinaryWrapper
, bundler
}@defs:
@ -118,9 +118,12 @@ let
wrappedRuby = stdenv.mkDerivation {
name = "wrapped-ruby-${pname'}";
nativeBuildInputs = [ makeWrapper ];
inherit (ruby) gemPath meta;
buildCommand = ''
nativeBuildInputs = [ makeBinaryWrapper ];
dontUnpack = true;
buildPhase = ''
mkdir -p $out/bin
for i in ${ruby}/bin/*; do
makeWrapper "$i" $out/bin/$(basename "$i") \
@ -131,6 +134,15 @@ let
--set GEM_PATH ${basicEnv}/${ruby.gemPath}
done
'';
dontInstall = true;
doCheck = true;
checkPhase = ''
$out/bin/ruby --help > /dev/null
'';
inherit (ruby) meta;
};
env = let