Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions pkgs/development/interpreters/ruby/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,9 @@ let
}:
let
ver = version;
isCross = stdenv.buildPlatform != stdenv.hostPlatform;
# https://github.com/ruby/ruby/blob/v3_2_2/yjit.h#L21
yjitSupported =
!isCross
&& (
stdenv.hostPlatform.isx86_64 || (!stdenv.hostPlatform.isWindows && stdenv.hostPlatform.isAarch64)
);
stdenv.hostPlatform.isx86_64 || (!stdenv.hostPlatform.isWindows && stdenv.hostPlatform.isAarch64);
rubyDrv = lib.makeOverridable (
{
stdenv,
Expand Down Expand Up @@ -181,6 +177,13 @@ let
];
propagatedBuildInputs = op jemallocSupport jemalloc;

env = lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && yjitSupport) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is cause of mass rebuild, can it be split ? if not, this should go to staging

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this case, it's the removal of cargo from the inputs that changes the ruby derivation.

The env input attribute in mkDerivation is special-cased and when it's an empty set, it has no effect.

nix-repl> stdenv.mkDerivation { name = "foo"; }                                             
«derivation /nix/store/w0ps5bzjcc5x3xcv8b327jfzmd5k5nsp-foo.drv»

nix-repl> stdenv.mkDerivation { name = "foo"; env = lib.optionalAttrs false { x = "x"; }; }
«derivation /nix/store/w0ps5bzjcc5x3xcv8b327jfzmd5k5nsp-foo.drv»

nix-repl> stdenv.mkDerivation { name = "foo"; env = lib.optionalAttrs true { x = "x"; }; }  
«derivation /nix/store/216b6l77hb1n2s6n6n7asfdj4b49qcg4-foo.drv»

I'll split that (cargo) change out if ruby cross-compiles fine without that change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up: #462631

# The ruby build system will use a bare `rust` command by default for its rust.
# We can use the Nixpkgs rust wrapper to work around the fact that our Rust builds
# for cross-compilation output for the build target by default.
NIX_RUSTFLAGS = "--target ${stdenv.hostPlatform.rust.rustcTargetSpec}";
};

enableParallelBuilding = true;
# /build/ruby-2.7.7/lib/fileutils.rb:882:in `chmod':
# No such file or directory @ apply2files - ...-ruby-2.7.7-devdoc/share/ri/2.7.0/system/ARGF/inspect-i.ri (Errno::ENOENT)
Expand Down
Loading