bundler-env: add .env
This commit is contained in:
parent
fe07c77ff1
commit
0deb3fce70
@ -246,9 +246,7 @@ let
|
|||||||
(map mkBuildFlags
|
(map mkBuildFlags
|
||||||
(lib.filter needsBuildFlags (attrValues instantiated)));
|
(lib.filter needsBuildFlags (attrValues instantiated)));
|
||||||
|
|
||||||
in
|
derivation = stdenv.mkDerivation {
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
inherit name;
|
inherit name;
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
@ -306,7 +304,36 @@ stdenv.mkDerivation {
|
|||||||
passthru = {
|
passthru = {
|
||||||
inherit ruby;
|
inherit ruby;
|
||||||
inherit bundler;
|
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;
|
inherit meta;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
in derivation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user