Adding "allBins" flag on bundlerEnv
The bin stubs need to be built where there's access to /nix/store - so it can't happen in a nix-shell run. Ergo, a shell.nix needs to be able to signal to the build that all bins need to be built.
This commit is contained in:
parent
0481a33d21
commit
7f6e8a1cd5
|
@ -12,6 +12,7 @@
|
||||||
, gemfile ? null
|
, gemfile ? null
|
||||||
, lockfile ? null
|
, lockfile ? null
|
||||||
, gemset ? null
|
, gemset ? null
|
||||||
|
, allBins ? false
|
||||||
, ruby ? defs.ruby
|
, ruby ? defs.ruby
|
||||||
, gemConfig ? defaultGemConfig
|
, gemConfig ? defaultGemConfig
|
||||||
, postBuild ? null
|
, postBuild ? null
|
||||||
|
@ -123,7 +124,17 @@ let
|
||||||
|
|
||||||
envPaths = lib.attrValues gems ++ lib.optional (!hasBundler) bundler;
|
envPaths = lib.attrValues gems ++ lib.optional (!hasBundler) bundler;
|
||||||
|
|
||||||
binPaths = if mainGem != null then [ mainGem ] ++ envPaths else envPaths;
|
binPaths = if !allBins && mainGem != null then [ mainGem ] else envPaths;
|
||||||
|
|
||||||
|
genStubs = binPaths: ''
|
||||||
|
${ruby}/bin/ruby ${./gen-bin-stubs.rb} \
|
||||||
|
"${ruby}/bin/ruby" \
|
||||||
|
"${confFiles}/Gemfile" \
|
||||||
|
"$out/${ruby.gemPath}" \
|
||||||
|
"${bundler}/${ruby.gemPath}" \
|
||||||
|
${lib.escapeShellArg binPaths} \
|
||||||
|
${lib.escapeShellArg groups}
|
||||||
|
'';
|
||||||
|
|
||||||
bundlerEnv = buildEnv {
|
bundlerEnv = buildEnv {
|
||||||
inherit ignoreCollisions;
|
inherit ignoreCollisions;
|
||||||
|
@ -133,15 +144,7 @@ let
|
||||||
paths = envPaths;
|
paths = envPaths;
|
||||||
pathsToLink = [ "/lib" ];
|
pathsToLink = [ "/lib" ];
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = (genStubs binPaths) + lib.optionalString (postBuild != null) postBuild;
|
||||||
${ruby}/bin/ruby ${./gen-bin-stubs.rb} \
|
|
||||||
"${ruby}/bin/ruby" \
|
|
||||||
"${confFiles}/Gemfile" \
|
|
||||||
"$out/${ruby.gemPath}" \
|
|
||||||
"${bundler}/${ruby.gemPath}" \
|
|
||||||
${lib.escapeShellArg binPaths} \
|
|
||||||
${lib.escapeShellArg groups}
|
|
||||||
'' + lib.optionalString (postBuild != null) postBuild;
|
|
||||||
|
|
||||||
meta = { platforms = ruby.meta.platforms; } // meta;
|
meta = { platforms = ruby.meta.platforms; } // meta;
|
||||||
|
|
||||||
|
@ -173,7 +176,7 @@ let
|
||||||
require 'bundler/setup'
|
require 'bundler/setup'
|
||||||
'';
|
'';
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "interactive-${drvName}-environment";
|
name = "${drvName}-interactive-environment";
|
||||||
nativeBuildInputs = [ wrappedRuby bundlerEnv ];
|
nativeBuildInputs = [ wrappedRuby bundlerEnv ];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export OLD_IRBRC="$IRBRC"
|
export OLD_IRBRC="$IRBRC"
|
||||||
|
|
Loading…
Reference in New Issue