From 7f6e8a1cd5297d35e7cf431f682b1b1abfa26f16 Mon Sep 17 00:00:00 2001 From: Judson Date: Sun, 26 Mar 2017 17:32:30 -0700 Subject: [PATCH] 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. --- .../ruby-modules/bundler-env/default.nix | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pkgs/development/ruby-modules/bundler-env/default.nix b/pkgs/development/ruby-modules/bundler-env/default.nix index 794dd11665d1..7d2f0efe0011 100644 --- a/pkgs/development/ruby-modules/bundler-env/default.nix +++ b/pkgs/development/ruby-modules/bundler-env/default.nix @@ -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"