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
1 changed files with 14 additions and 11 deletions
|
@ -12,6 +12,7 @@
|
|||
, gemfile ? null
|
||||
, lockfile ? null
|
||||
, gemset ? null
|
||||
, allBins ? false
|
||||
, ruby ? defs.ruby
|
||||
, gemConfig ? defaultGemConfig
|
||||
, postBuild ? null
|
||||
|
@ -123,7 +124,17 @@ let
|
|||
|
||||
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 {
|
||||
inherit ignoreCollisions;
|
||||
|
@ -133,15 +144,7 @@ let
|
|||
paths = envPaths;
|
||||
pathsToLink = [ "/lib" ];
|
||||
|
||||
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;
|
||||
postBuild = (genStubs binPaths) + lib.optionalString (postBuild != null) postBuild;
|
||||
|
||||
meta = { platforms = ruby.meta.platforms; } // meta;
|
||||
|
||||
|
@ -173,7 +176,7 @@ let
|
|||
require 'bundler/setup'
|
||||
'';
|
||||
in stdenv.mkDerivation {
|
||||
name = "interactive-${drvName}-environment";
|
||||
name = "${drvName}-interactive-environment";
|
||||
nativeBuildInputs = [ wrappedRuby bundlerEnv ];
|
||||
shellHook = ''
|
||||
export OLD_IRBRC="$IRBRC"
|
||||
|
|
Loading…
Reference in a new issue