bundlerEnv: add wrapper

This commit is contained in:
Nikolay Amiantov 2016-01-06 21:43:22 +03:00
parent 732495017b
commit 75358ad0e7

View file

@ -65,8 +65,24 @@ let
"${bundler}/${ruby.gemPath}" \
${shellEscape (toString envPaths)}
'' + lib.optionalString (postBuild != null) postBuild;
passthru = {
passthru = rec {
inherit ruby bundler meta gems;
wrapper = stdenv.mkDerivation {
name = "wrapper-${name}";
nativeBuildInputs = [ makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
for i in ${ruby}/bin/*; do
makeWrapper "$i" $out/bin/$(basename "$i") \
--set BUNDLE_GEMFILE ${confFiles}/Gemfile \
--set BUNDLE_PATH ${bundlerEnv}/${ruby.gemPath} \
--set GEM_HOME ${bundlerEnv}/${ruby.gemPath} \
--set GEM_PATH ${bundlerEnv}/${ruby.gemPath}
done
'';
};
env = let
irbrc = builtins.toFile "irbrc" ''
if !(ENV["OLD_IRBRC"].nil? || ENV["OLD_IRBRC"].empty?)
@ -77,12 +93,8 @@ let
'';
in stdenv.mkDerivation {
name = "interactive-${name}-environment";
nativeBuildInputs = [ ruby bundlerEnv ];
nativeBuildInputs = [ wrapper bundlerEnv ];
shellHook = ''
export BUNDLE_GEMFILE=${confFiles}/Gemfile
export BUNDLE_PATH=${bundlerEnv}/${ruby.gemPath}
export GEM_HOME=${bundlerEnv}/${ruby.gemPath}
export GEM_PATH=${bundlerEnv}/${ruby.gemPath}
export OLD_IRBRC="$IRBRC"
export IRBRC=${irbrc}
'';