git.iko.soy/typeable/nixpkgs
on master help sign in
bundlerEnv: fix for Ruby 2.7

Setting a Bundler version with GEM_PATH doesn't seem to work in Ruby 2.7, so we need to use the LOAD_PATH instead. Without this, bundlerEnv environments will always use the version of Bundler that comes with Ruby, which won't necessarily work because it isn't the version that was used to generate the bundle. For example, building ronn with Ruby 2.7 without this change results in a broken executable, but it works (when built with all packaged Ruby versions) after this change.

commit106d0920d9d511268b435adcc06697f8c38a86e5 authorAlyssa Ross <hi@alyssa.is> dateThu 26 Dec 2019, 15:49 (7 years ago) parent7c0bc04
2 files changed+3−3
pkgs/development/ruby-modules/bundled-common/functions.nix+1−1 pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb+2−2
pkgs/development/ruby-modules/bundled-common/functions.nix+1−1
@@ -64,7 +64,7 @@ in rec {
6464 "${ruby}/bin/ruby" \
6565 "${confFiles}/Gemfile" \
6666 "$out/${ruby.gemPath}" \
67− "${bundler}/${ruby.gemPath}" \
67+ "${bundler}/${ruby.gemPath}/gems/bundler-${bundler.version}" \
6868 ${lib.escapeShellArg binPaths} \
6969 ${lib.escapeShellArg groups}
7070 '';
pkgs/development/ruby-modules/bundled-common/gen-bin-stubs.rb+2−2
@@ -8,7 +8,7 @@ out = ENV["out"]
88ruby = ARGV[0]
99gemfile = ARGV[1]
1010bundle_path = ARGV[2]
11−bundler_gem_path = ARGV[3]
11+bundler_path = ARGV[3]
1212paths = ARGV[4].split
1313groups = ARGV[5].split
1414
@@ -35,7 +35,7 @@ ENV["BUNDLE_GEMFILE"] = #{gemfile.dump}
3535ENV["BUNDLE_PATH"] = #{bundle_path.dump}
3636ENV['BUNDLE_FROZEN'] = '1'
3737
38−Gem.use_paths(#{bundler_gem_path.dump}, ENV["GEM_PATH"])
38+$LOAD_PATH.unshift #{bundler_path.dump} + "/lib"
3939
4040require 'bundler'
4141Bundler.setup(#{groups.map(&:dump).join(', ')})