bundlerEnv: add wrapper

+18 -6
+18 -6
pkgs/development/interpreters/ruby/bundler-env/default.nix
··· 65 65 "${bundler}/${ruby.gemPath}" \ 66 66 ${shellEscape (toString envPaths)} 67 67 '' + lib.optionalString (postBuild != null) postBuild; 68 - passthru = { 68 + passthru = rec { 69 69 inherit ruby bundler meta gems; 70 + 71 + wrapper = stdenv.mkDerivation { 72 + name = "wrapper-${name}"; 73 + nativeBuildInputs = [ makeWrapper ]; 74 + buildCommand = '' 75 + mkdir -p $out/bin 76 + for i in ${ruby}/bin/*; do 77 + makeWrapper "$i" $out/bin/$(basename "$i") \ 78 + --set BUNDLE_GEMFILE ${confFiles}/Gemfile \ 79 + --set BUNDLE_PATH ${bundlerEnv}/${ruby.gemPath} \ 80 + --set GEM_HOME ${bundlerEnv}/${ruby.gemPath} \ 81 + --set GEM_PATH ${bundlerEnv}/${ruby.gemPath} 82 + done 83 + ''; 84 + }; 85 + 70 86 env = let 71 87 irbrc = builtins.toFile "irbrc" '' 72 88 if !(ENV["OLD_IRBRC"].nil? || ENV["OLD_IRBRC"].empty?) ··· 77 93 ''; 78 94 in stdenv.mkDerivation { 79 95 name = "interactive-${name}-environment"; 80 - nativeBuildInputs = [ ruby bundlerEnv ]; 96 + nativeBuildInputs = [ wrapper bundlerEnv ]; 81 97 shellHook = '' 82 - export BUNDLE_GEMFILE=${confFiles}/Gemfile 83 - export BUNDLE_PATH=${bundlerEnv}/${ruby.gemPath} 84 - export GEM_HOME=${bundlerEnv}/${ruby.gemPath} 85 - export GEM_PATH=${bundlerEnv}/${ruby.gemPath} 86 98 export OLD_IRBRC="$IRBRC" 87 99 export IRBRC=${irbrc} 88 100 '';