New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ruby_3_0: init 3.0.0 #107933
ruby_3_0: init 3.0.0 #107933
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
untested, code looks fine
pkgs/top-level/all-packages.nix
Outdated
@@ -10836,7 +10836,8 @@ in | |||
}) | |||
ruby_2_5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop 2.5 anytime soon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By March end after it hits EOL, maybe: https://www.ruby-lang.org/en/downloads/branches/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we know it's EOL'd before the next release, it can be done ASAP for unstable. Though I suggest in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see that anyone else had done it, so: #111662.
Please target staging. |
/rebase-staging |
f1d6f7f
to
b815195
Compare
Is there a problem in the tests? I see some failures, but it looks like a (temporary?) network issue:
It's been about 2.5 weeks since Ruby 3.0 was released... is there anything else I can do to help push this along? |
By the way, there's the
|
There is no network connection in the test phase. |
is there anything I can do to help bring this about? |
Here's a potential fix. The problem seems to be that when using railsexpress, the source is built twice, and once from git, which doesn't include the bundled gems that the release tarball has. So this just injects them. Might need some fiddling to avoid rebuilds of older Ruby versions though. diff --git a/pkgs/development/interpreters/ruby/bundled-gems.nix b/pkgs/development/interpreters/ruby/bundled-gems.nix
new file mode 100644
index 000000000000..6b7f2f20a16b
--- /dev/null
+++ b/pkgs/development/interpreters/ruby/bundled-gems.nix
@@ -0,0 +1,12 @@
+{
+ "3.0.0" = {
+ "minitest-5.14.2" = "sha256-m0ATOOKHxQzSNUNTtLeB03ZthjyuQTsqG/WF0jcTHpw=";
+ "power_assert-1.2.0" = "sha256-Qfqz2cpGutN/WXKem77D/XRdLyY9GzBovG8hhjtWsGo=";
+ "rake-13.0.3" = "sha256-xyizOlvQlTQpCnAP8X3As01tMqriOjT0Y8TP5KooM8Y=";
+ "test-unit-3.3.7" = "sha256-5cg8h+jMiwjjvbUs9Fr57S+5QntkgfWSHDhFadr6e9k=";
+ "rexml-3.2.4" = "sha256-A2sx88BSvkK3ouaRTzMi2q7M5GsXKAbzj+pClzibe9Y=";
+ "rss-0.2.9" = "sha256-oEWHa+qbNUViQdTVe5NA2eOgQiZNa0rqnZOYPA/oP6w=";
+ "rbs-1.0.0" = "sha256-XOoW2A00VODqpvev72VV3e0YwL0rK/+d+MThKGCr7rE=";
+ "typeprof-0.11.0" = "sha256-2emPq1+ZN6HlQiSGsqPRXL4C0skAL1UapyRwabFlf/I=";
+ };
+}
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 7696b716d02a..0812fcd55bfd 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -115,13 +115,28 @@ let
cp -r ${rubygems}/test/rubygems $sourceRoot/test
'';
- postPatch = ''
+ postPatch = let
+ bundledGems = (import ./bundled-gems.nix);
+ forThisVersion = bundledGems.${ver.majMinTiny};
+ copyGems = if (lib.versionAtLeast ver.majMin "3.0") then
+ lib.mapAttrsToList (name: hash:
+ let
+ src = fetchurl {
+ name = "${name}.gem";
+ inherit hash;
+ url = "https://rubygems.org/downloads/${name}.gem";
+ };
+ in "cp ${src} gems/${name}.gem") forThisVersion
+ else [];
+ in ''
sed -i configure.ac -e '/config.guess/d'
cp --remove-destination ${config}/config.guess tool/
cp --remove-destination ${config}/config.sub tool/
# Make the build reproducible for ruby <= 2.7
# See https://github.com/ruby/io-console/commit/679a941d05d869f5e575730f6581c027203b7b26#diff-d8422f096931c58d4463e2489f62a228b0f24f0492950ba88c8c89a0d741cfe6
sed -i ext/io/console/io-console.gemspec -e '/s\.date/d'
+
+ ${lib.concatStringsSep "\n" copyGems}
'';
# Force the revision.h generation. Somehow `revision.tmp` is an empty |
Yea, try to validate that common scenarios work as intended. If you're using |
I don't use |
I haven't used
Running it takes a very long time (and is checking for each package on every cachix source on my system!), so I re-ran with
I'll retry after applying @manveru's patch. |
sorry, I meant to say you can do |
This is the first I've even heard of the railsexpress patches. They're apparently just some sets of changes collected by the creator of RVM -- does anyone really use these, or is it adding complexity here for no reason? |
FWIW when I try to build this, it tries to write rdoc files into /homeless-shelter:
I'm using nix on macOS 10.15.7. I checked out nixpkgs, merged @marsam's branch into master and applied @manveru's patch, then ran Here's the build log, in case it's any help If instead I build 2.7 ( Update: Ah, if I set |
^ This has been mostly ok for me since installing with {
hiredis = attrs: {
buildFlags = ["--with-cflags=-fdeclspec"];
};
byebug = attrs: {
buildFlags = ["--with-cflags=-fdeclspec" "--with-cppflags=-fdeclspec"];
};
} for anything that imports ruby 3's header files. This fixes errors like:
Not sure if there's a more global way of supplying that |
The rdoc error seems to be rdoc creating I think putting diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 0812fcd55bf..1c633d8c918 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -161,6 +161,10 @@ let
preConfigure = opString docSupport ''
configureFlagsArray+=("--with-ridir=$devdoc/share/ri")
+
+ # rdoc creates XDG_DATA_DIR (defaulting to HOME/.local/share) even if
+ # it's not going to be used.
+ export HOME=$TMPDIR
'';
# fails with "16993 tests, 2229489 assertions, 105 failures, 14 errors, 89 skips"
diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix
index 9e64b120af8..78395c88bcf 100644
--- a/pkgs/development/ruby-modules/gem/default.nix
+++ b/pkgs/development/ruby-modules/gem/default.nix
@@ -129,6 +129,12 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
runHook postUnpack
'';
+ # As of ruby 3.0, ruby headers require -fdeclspec when building with clang
+ # Introduced in https://github.com/ruby/ruby/commit/0958e19ffb047781fe1506760c7cbd8d7fe74e57
+ NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isClang && lib.versionAtLeast ruby.version.major "3") [
+ "-fdeclspec"
+ ];
+
buildPhase = attrs.buildPhase or ''
runHook preBuild
|
ruby_2_5 was removed from nixpkgs in 1c33c0a
b815195
to
fd8a52d
Compare
Sorry for the delay, this took WAY longer than I expected. |
9bd83f4
to
4caae49
Compare
This is still a problem on darwin. The difference seems to be in rdoc's error handling on this line: https://github.com/ruby/rdoc/blob/d23594ecd781ee1c79ef284eebfdfa2a0fde218a/lib/rdoc.rb#L139 On linux, attempting to create |
4caae49
to
7121ef6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested a medium-sized project on x86_64-darwin and x86_64-linux. LGTM.
Motivation for this change
https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)