mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-24 21:14:52 +00:00
Merge pull request #6147 from abbradar/bundlerenv-env
bundler-env: add .env
This commit is contained in:
commit
b4d4b88988
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user