From a720bc44c23c80a49dab05c7907c2e58681b425d Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 1 Jun 2022 21:13:44 +0300 Subject: [PATCH] buildRubyGem: fix bundix cross allows building bundix but most ruby gems still fail with ``` ++ gem install --local --force --http-proxy http://nodtd.invalid --ignore-dependencies --install-dir /nix/store/...-ruby-aarch64-unknown-linux-gnu2.7.6-nio4r-2.5.8-aarch64-unknown-linux-gnu/lib/ruby/gems/2.7.0 --build-root / --backtrace --no-env-shebang -N /nix/store/...-nio4r-2.5.8.gem -- /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 8: require: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 9: require: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 10: require: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 12: required_version: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 14: unless: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 15: abort: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 16: end: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 18: args: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 20: begin: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 21: Gem::GemRunner.new.run: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 22: rescue: command not found /nix/store/...-ruby-aarch64-unknown-linux-gnu-2.7.6/bin/gem: line 23: exit: e.exit_code: numeric argument required ``` --- pkgs/development/ruby-modules/gem/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix index 7ba8c70a9805..649d33c46461 100644 --- a/pkgs/development/ruby-modules/gem/default.nix +++ b/pkgs/development/ruby-modules/gem/default.nix @@ -35,6 +35,7 @@ lib.makeOverridable ( , namePrefix ? (let rubyName = builtins.parseDrvName ruby.name; in "${rubyName.name}${rubyName.version}-") +, nativeBuildInputs ? [] , buildInputs ? [] , meta ? {} , patches ? [] @@ -87,11 +88,15 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { inherit dontStrip; inherit type; - buildInputs = [ + nativeBuildInputs = [ ruby makeWrapper ] ++ lib.optionals (type == "git") [ gitMinimal ] ++ lib.optionals (type != "gem") [ bundler ] - ++ lib.optional stdenv.isDarwin darwin.libobjc + ++ nativeBuildInputs; + + buildInputs = [ + ruby + ] ++ lib.optionals stdenv.isDarwin [ darwin.libobjc ] ++ buildInputs; #name = builtins.trace (attrs.name or "no attr.name" ) "${namePrefix}${gemName}-${version}";