ruby: Expose generic builder (#173390)

To avoid duplicating the ruby compilation code, this change exposes two
functions `mkRubyVersion` and `mkRuby`, which can be used in an overlay
to build any past or current ruby version.

An example overlay:
```nix
self: super:

{
  ruby_2_7_6 = super.mkRuby {
    version = super.mkRubyVersion "2" "7" "6" "";
    sha256 = "042xrdk7hsv4072bayz3f8ffqh61i8zlhvck10nfshllq063n877";
  };

  ruby_3_1_2 = super.mkRuby {
    version = super.mkRubyVersion "3" "1" "2" "";
    sha256 = "0gm84ipk6mrfw94852w5h7xxk2lqrxjbnlwb88svf0lz70933131";
  };
}
```
This commit is contained in:
Juan Ibiapina 2022-07-04 11:57:06 +02:00 committed by GitHub
parent 2e37f787c9
commit 62e5acd0a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -260,6 +260,9 @@ let
) args; in self;
in {
mkRubyVersion = rubyVersion;
mkRuby = generic;
ruby_2_7 = generic {
version = rubyVersion "2" "7" "6" "";
sha256 = "042xrdk7hsv4072bayz3f8ffqh61i8zlhvck10nfshllq063n877";

View file

@ -14870,6 +14870,8 @@ with pkgs;
inherit (darwin) libiconv libobjc libunwind;
inherit (darwin.apple_sdk.frameworks) Foundation;
})
mkRubyVersion
mkRuby
ruby_2_7
ruby_3_0
ruby_3_1;