Skip to content
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: export generic builder #55636

Closed
wants to merge 3 commits into from

Conversation

siers
Copy link
Member

@siers siers commented Feb 12, 2019

Allow building any ruby, like ruby-build does.

Motivation for this change

I think it would it make sense to allow building (m)any ruby, like ruby-build does.
What do you think about this change, @manveru, @vrthra? (did I ping the wrong people? 😅)

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@alyssais
Copy link
Member

This is wonderful. I’d been wanting to get around to this. I’ll have some more substantial feedback later, but I definitely want to have this in Nixpkgs

@manveru
Copy link
Contributor

manveru commented Feb 13, 2019

I like this very much :)

@siers
Copy link
Member Author

siers commented Feb 13, 2019

I thought thought that maybe the version should be called something more specific, if maybe that is to be changed, so backwards compatibility would be easier.

@@ -198,6 +198,10 @@ let
) args; in self;

in {
ruby_build_generic = { version, ... } @ args: generic (args // {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ruby_build_generic = { version, ... } @ args: generic (args // {
mkRuby = { version, ... } @ args: generic (args // {

mk or build are the name prefixes that are generally used by that produce derivations.

It would be nice is mkRuby could also be used subsequently below to make it clear how to use it.

@zimbatm
Copy link
Member

zimbatm commented Feb 13, 2019

Great idea!

@siers siers force-pushed the ruby-export-generic-builder branch 2 times, most recently from 5534e14 to 11cedf1 Compare February 17, 2019 21:50
Allow building any ruby, like ruby-build does.
@siers siers force-pushed the ruby-export-generic-builder branch from 11cedf1 to b7b4c44 Compare February 17, 2019 23:39
@siers
Copy link
Member Author

siers commented Feb 17, 2019

I renamed it to mkRuby and rebased the branch (incorrectly, initially).

@@ -97,7 +97,7 @@ let
(import ./patchsets.nix {
inherit patchSet useRailsExpress ops;
patchLevel = ver.patchLevel;
})."${ver.majMinTiny}";
})."${ver.majMinTiny}" or [];
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 that, if we’re doing this, the existing rubies should be built using mkRuby, and their patches should be passed into it. (I’d be fine with getting rid of patchsets.nix and just inlining the patches here — there are a lot fewer patches than there used to be.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Should I not use the patches if useRailsExpress is false within the mkDerivation?

@siers
Copy link
Member Author

siers commented Feb 24, 2019

Patches inlined, mkRuby — used! I added versionNrs and versionStr, because it felt right.

@siers
Copy link
Member Author

siers commented Feb 27, 2019

The builds should cache though, right? (By that I mean it should be possible to make them cache, since nothing really changed, since the version numbers get converted to the same end value.)

Also, ping!

version = rubyVersion "2" "6" "1" "";
sha256 = {
src = "1f0w37jz2ryvlx260rw3s3wl0wg7dkzphb54lpvrqg90pfvly0hp";
git = "07gp7df1izw9rdbp9ciw4q5kq8icx3zd5w1xrhwsw0dfbsmmnsrj";
};
# no Rails Express patchset yet (2019-01-30)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I just copypasted, but I can include it — sure. :)

ruby_2_3 = generic {
version = rubyVersion "2" "3" "8" "";
in rec {
mkRuby = { version ? null, versionNrs ? null, versionStr ? null, ... } @ args:
Copy link
Member

Choose a reason for hiding this comment

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

Could also add some documentation to doc/languages-frameworks/ruby.xml about this function?

@siers
Copy link
Member Author

siers commented Mar 13, 2019

Inlining the patches, which happens from 7297606 to b7b4c44, makes the cache fail. Is that supposed to be that way? I don't entirely know why or should it be that way.
Here's the nix-diff of ruby_2_3 instantiations:

+ /nix/store/8738cn2080gjc66k3clg7ddjafgfiqa7-ruby-2.3.8.drv:{out}
• The input named `ruby-2.3.8` differs
  - /nix/store/n6sbal9nmmnb6f9qg53n7lnskadv2p1l-ruby-2.3.8.drv:{out}
  + /nix/store/w22ldvcmfzkl0ms9r346ls95rk5l4w3b-ruby-2.3.8.drv:{out}
  • The set of input names do not match:
      - source
  • The environments do not match:
      patches=''
          ←/nix/store/swd1jahgs16x7vc13pqyha8h3v4ra5fb-source/patches/ruby/2.3/head/railsexpress/01-skip-broken-tests.patch /nix/store/swd1jahgs16x7vc13pqyha8h3v4ra5fb-source/patches/ruby/2.3/head/railsexpress/02-improve-gc-stats.patch /nix/store/swd1jahgs16x7vc13pqyha8h3v4ra5fb-source/patches/ruby/2.3/head/railsexpress/03-display-more-detailed-stack-trace.patch←
      ''

Please advise, I've no idea. :)

@alyssais
Copy link
Member

alyssais commented Mar 20, 2019 via email

@siers
Copy link
Member Author

siers commented Mar 20, 2019 via email

@alyssais
Copy link
Member

alyssais commented Mar 21, 2019 via email

@siers
Copy link
Member Author

siers commented Mar 21, 2019

I could just move the versionStr -> rubyVersion function from mkRuby into a function with its own name so you could 'get' it without having to read the implementation. How 'bout that? :P

Do those rebuilds qualify this as non-mergable for now?

@manveru
Copy link
Contributor

manveru commented Mar 21, 2019

I've used rubyVersion = lib.replaceChars ["." "\n"] ["_" ""] ( lib.readFile .ruby-version); for that purpose so far.

@alyssais
Copy link
Member

alyssais commented Mar 21, 2019 via email

@siers
Copy link
Member Author

siers commented Mar 22, 2019

@manveru That looks like a list. The object that ought to be created is that weird set that pkgs/development/interpreters/ruby/ruby-version.nix creates.

@FRidh FRidh added this to Not ready in Staging Oct 24, 2019
@FRidh FRidh moved this from Not ready to New in Staging Oct 24, 2019
@FRidh FRidh moved this from New to Not ready in Staging Oct 24, 2019
@siers siers closed this Jan 26, 2020
Staging automation moved this from WIP to Done Jan 26, 2020
@maksar
Copy link
Contributor

maksar commented Oct 15, 2020

I am not quite familiar with PR processes in NixPkgs. @siers Can you please explain why this was closed?

@siers
Copy link
Member Author

siers commented Oct 15, 2020

because I don't have lots of dedicated computer volunteer time and so I couldn't support it

@maksar
Copy link
Contributor

maksar commented Oct 15, 2020

because I don't have lots of dedicated computer volunteer time and so I couldn't support it

Got it ;) Maybe I'll continue a bit later. Will use your fork, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Staging
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

7 participants