ruby: allow for passing build arguments

+25 -3
+25 -3
pkgs/development/interpreters/ruby/bundler-env.nix
··· 8 # This is a work-in-progress. 9 # The idea is that his will replace load-ruby-env.nix. 10 11 - { name, gemset, gemfile, lockfile, ruby ? defs.ruby, fixes ? gemFixes }@args: 12 13 let 14 const = x: y: x; 15 bundler = bundler_HEAD.override { inherit ruby; }; 16 inherit (builtins) attrValues; ··· 128 then acc 129 else acc + '' 130 cp ${writeScript "${next.name}-pre-install" '' 131 - #!/bin/sh 132 133 buildInputs="${toString (next.buildInputs or [])}" 134 nativeBuildInputs="${toString (next.nativeBuildInputs or [])}" ··· 227 end 228 ''; 229 230 in 231 232 stdenv.mkDerivation { ··· 262 mkdir pre-installers 263 ${createPreInstallers} 264 265 mkdir $out/bin 266 cp ${./monkey_patches.rb} monkey_patches.rb 267 export RUBYOPT="-rmonkey_patches.rb -I $(pwd -P)" 268 - bundler install --frozen --binstubs 269 ''; 270 passthru = { 271 inherit ruby;
··· 8 # This is a work-in-progress. 9 # The idea is that his will replace load-ruby-env.nix. 10 11 + { name, gemset, gemfile, lockfile, ruby ? defs.ruby, fixes ? gemFixes 12 + , enableParallelBuilding ? false # TODO: this might not work, given the env-var shinanigans. 13 + , documentation ? false}@args: 14 15 let 16 + 17 + shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'"; 18 const = x: y: x; 19 bundler = bundler_HEAD.override { inherit ruby; }; 20 inherit (builtins) attrValues; ··· 132 then acc 133 else acc + '' 134 cp ${writeScript "${next.name}-pre-install" '' 135 + #!${stdenv.shell} 136 137 buildInputs="${toString (next.buildInputs or [])}" 138 nativeBuildInputs="${toString (next.nativeBuildInputs or [])}" ··· 231 end 232 ''; 233 234 + needsBuildArgs = attrs: attrs ? buildArgs; 235 + 236 + mkBuildArgs = spec: 237 + "export BUNDLE_BUILD__${lib.toUpper spec.name}='${lib.concatStringsSep " " (map shellEscape spec.buildArgs)}'"; 238 + 239 + allBuildArgs = 240 + lib.concatStringsSep "\n" 241 + (map mkBuildArgs 242 + (lib.filter needsBuildArgs (attrValues instantiated))); 243 + 244 in 245 246 stdenv.mkDerivation { ··· 276 mkdir pre-installers 277 ${createPreInstallers} 278 279 + ${allBuildArgs} 280 + 281 + ${lib.optionalString (!documentation) '' 282 + mkdir home 283 + HOME="$(pwd -P)/home" 284 + echo "gem: --no-rdoc --no-ri" > $HOME/.gemrc 285 + ''} 286 + 287 mkdir $out/bin 288 cp ${./monkey_patches.rb} monkey_patches.rb 289 export RUBYOPT="-rmonkey_patches.rb -I $(pwd -P)" 290 + bundler install --frozen --binstubs ${lib.optionalString enableParallelBuilding "--jobs $NIX_BUILD_CORES"} 291 ''; 292 passthru = { 293 inherit ruby;