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鈥檒l 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
Closed

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

@alyssais alyssais commented Feb 12, 2019

This is wonderful. I鈥檇 been wanting to get around to this. I鈥檒l have some more substantial feedback later, but I definitely want to have this in Nixpkgs

@manveru
Copy link
Contributor

@manveru manveru commented Feb 13, 2019

I like this very much :)

@siers
Copy link
Member Author

@siers 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

@zimbatm zimbatm Feb 13, 2019

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 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 Feb 17, 2019
Allow building any ruby, like ruby-build does.
@siers siers force-pushed the ruby-export-generic-builder branch from 11cedf1 to b7b4c44 Feb 17, 2019
@siers
Copy link
Member Author

@siers 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

@alyssais alyssais Feb 18, 2019

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鈥檙e doing this, the existing rubies should be built using mkRuby, and their patches should be passed into it. (I鈥檇 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

@siers siers Feb 24, 2019

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 siers commented Feb 24, 2019

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

@siers
Copy link
Member Author

@siers 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

@manveru manveru Feb 27, 2019

Choose a reason for hiding this comment

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

Copy link
Member Author

@siers siers Feb 27, 2019

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

@Mic92 Mic92 Feb 27, 2019

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 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 alyssais commented Mar 20, 2019

@siers
Copy link
Member Author

@siers siers commented Mar 20, 2019

@alyssais
Copy link
Member

@alyssais alyssais commented Mar 21, 2019

@siers
Copy link
Member Author

@siers 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 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 alyssais commented Mar 21, 2019

@siers
Copy link
Member Author

@siers 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 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 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 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
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants