Merge pull request #6147 from abbradar/bundlerenv-env

bundler-env: add .env
This commit is contained in:
Charles Strahan 2015-03-02 18:28:02 -05:00
commit b4d4b88988

View File

@ -246,9 +246,7 @@ let
(map mkBuildFlags
(lib.filter needsBuildFlags (attrValues instantiated)));
in
stdenv.mkDerivation {
derivation = stdenv.mkDerivation {
inherit name;
buildInputs = [
@ -306,7 +304,36 @@ stdenv.mkDerivation {
passthru = {
inherit ruby;
inherit bundler;
env = let
irbrc = builtins.toFile "irbrc" ''
if not ENV["OLD_IRBRC"].empty?
require ENV["OLD_IRBRC"]
end
require 'rubygems'
require 'bundler/setup'
'';
in stdenv.mkDerivation {
name = "interactive-${name}-environment";
nativeBuildInputs = [ ruby derivation ];
shellHook = ''
export BUNDLE_GEMFILE=${derivation.bundle}/Gemfile
export GEM_HOME=${derivation}/${ruby.gemPath}
export NIX_BUNDLER_GEMPATH=${bundler}/${ruby.gemPath}
export GEM_PATH=$NIX_BUNDLER_GEMPATH:$GEM_HOME
export OLD_IRBRC="$IRBRC"
export IRBRC=${irbrc}
'';
buildCommand = ''
echo >&2 ""
echo >&2 "*** Ruby 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
echo >&2 ""
exit 1
'';
};
};
inherit meta;
}
};
in derivation