summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2021-03-06 17:24:04 -0500
committerSamuel Dionne-Riel <samuel@dionne-riel.com>2021-03-06 22:30:55 -0500
commit6638690261892408a8ef66dc3bd99e8f607a5dd8 (patch)
tree73aacacd9daae5956aeb9d1192c64b4af70f1eb0 /pkgs/development/interpreters
parent6b8fa0aaf69ba4e7f46b5080c76811c7ebeb47fb (diff)
downloadnixpkgs-6638690261892408a8ef66dc3bd99e8f607a5dd8.tar
nixpkgs-6638690261892408a8ef66dc3bd99e8f607a5dd8.tar.gz
nixpkgs-6638690261892408a8ef66dc3bd99e8f607a5dd8.tar.bz2
nixpkgs-6638690261892408a8ef66dc3bd99e8f607a5dd8.tar.lz
nixpkgs-6638690261892408a8ef66dc3bd99e8f607a5dd8.tar.xz
nixpkgs-6638690261892408a8ef66dc3bd99e8f607a5dd8.tar.zst
nixpkgs-6638690261892408a8ef66dc3bd99e8f607a5dd8.zip
ruby: Use hostPlatform
Using `stdenv.targetPlatform` gives the wrong platform in buildPackages.

E.g.:

```
 $ nix-diff --color never $(env -i nix-instantiate -A pkgs.ruby -A pkgs.pkgsCross.aarch64-multiplatform.buildPackages.ruby)
- /nix/store/w8wk99p4gadns35n2l0fr7wx56jlwnnx-ruby-2.6.6.drv:{out}
+ /nix/store/5ywj7nicjai6ji4g33yh6nvz1b5fq7xw-ruby-2.6.6.drv:{out}
• The input named `ruby-2.6.6` differs
  - /nix/store/4a6nag89dcxwdf32820z6dfwwpfgab8s-ruby-2.6.6.drv:{out}
  + /nix/store/40pakkdfv578zffx3y11qd5ckcp2xpzm-ruby-2.6.6.drv:{out}
  • The environments do not match:
      postInstall=''
          # Remove unnecessary groff reference from runtime closure, since it's big
          sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb

          # Bundler tries to create this directory
          mkdir -p $out/nix-support
          cat > $out/nix-support/setup-hook <<EOF
          addGemPath() {
            addToSearchPath GEM_PATH \$1/lib/ruby/gems/2.6.0
          }
          addRubyLibPath() {
            addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby
            addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/2.6.0
            addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/2.6.0/←x86_←→aarch→64-linux
          }

          addEnvHooks "$hostOffset" addGemPath
          addEnvHooks "$hostOffset" addRubyLibPath
          EOF

          rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
      ''
• Skipping environment comparison
```

`pkgs.pkgsCros.*.buildPackage.ruby` should be equivalent to `pkgs.ruby`.
It wasn't.
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/ruby/default.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 65189fda079..3bf8ffab0eb 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -50,7 +50,7 @@ let
       # - If you run:
       #     ruby -e "puts RbConfig::CONFIG['configure_args']"
       # - In:
-      #     $out/${passthru.libPath}/${stdenv.targetPlatform.system}/rbconfig.rb
+      #     $out/${passthru.libPath}/${stdenv.hostPlatform.system}/rbconfig.rb
       #   Or (usually):
       #     $(nix-build -A ruby)/lib/ruby/2.6.0/x86_64-linux/rbconfig.rb
       # - In $out/lib/libruby.so and/or $out/lib/libruby.dylib
@@ -175,7 +175,7 @@ let
                 $out/lib/libruby*
               ${removeReferencesTo}/bin/remove-references-to \
                 -t ${stdenv.cc} \
-                $out/${passthru.libPath}/${stdenv.targetPlatform.system}/rbconfig.rb
+                $out/${passthru.libPath}/${stdenv.hostPlatform.system}/rbconfig.rb
             ''
           }
           # Bundler tries to create this directory
@@ -187,7 +187,7 @@ let
           addRubyLibPath() {
             addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby
             addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/${ver.libDir}
-            addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/${ver.libDir}/${stdenv.targetPlatform.system}
+            addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/${ver.libDir}/${stdenv.hostPlatform.system}
           }
 
           addEnvHooks "$hostOffset" addGemPath