rubyMinimal: ruby with all options disabled by default

Similar to `gitMinimal` or `pythonMinimal`, this is useful for scripts
which don’t use anything but the standard library and want a small
footprint.
This commit is contained in:
Profpatsch 2019-12-12 16:46:04 +01:00
parent 80c07f8aaf
commit 7d4c1ae7f1
2 changed files with 20 additions and 5 deletions

@ -149,14 +149,14 @@ let
postInstall = ''
# Remove unnecessary groff reference from runtime closure, since it's big
sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb
${lib.optionalString removeReferenceToCC ''
${
lib.optionalString removeReferenceToCC ''
# Get rid of the CC runtime dependency
${removeReferencesTo}/bin/remove-references-to \
-t ${stdenv.cc} \
$out/lib/libruby.so.*
''}
$out/lib/libruby*
''
}
# Bundler tries to create this directory
mkdir -p $out/nix-support
cat > $out/nix-support/setup-hook <<EOF

@ -9354,6 +9354,21 @@ in
ruby_2_5
ruby_2_6;
rubyMinimal = ruby.override {
# gem support is minimal overhead
rubygemsSupport = true;
useRailsExpress = false;
zlibSupport = false;
opensslSupport = false;
gdbmSupport = false;
cursesSupport = false;
docSupport = false;
yamlSupport = false;
fiddleSupport = false;
# remove gcc from runtime closure
removeReferenceToCC = true;
};
ruby = ruby_2_6;
rubyPackages_2_4 = recurseIntoAttrs ruby_2_4.gems;