2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, callPackage, fetchurl, makeWrapper, jre }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
# The version number here is whatever is reported by the RUBY_VERSION string
|
2020-08-20 17:08:02 +00:00
|
|
|
rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "5" "7" "";
|
2020-04-24 23:36:52 +00:00
|
|
|
jruby = stdenv.mkDerivation rec {
|
|
|
|
pname = "jruby";
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
version = "9.2.17.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz";
|
2021-05-20 23:08:51 +00:00
|
|
|
sha256 = "sha256-dwHTU3s6YG0nZaxtXEDmdd2qAdPOutJqIaZuOq3VwgI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -pv $out/docs
|
|
|
|
mv * $out
|
|
|
|
rm $out/bin/*.{bat,dll,exe,sh}
|
|
|
|
mv $out/COPYING $out/LICENSE* $out/docs
|
|
|
|
|
|
|
|
for i in $out/bin/jruby{,.bash}; do
|
|
|
|
wrapProgram $i \
|
2021-03-12 07:09:13 +00:00
|
|
|
--set JAVA_HOME ${jre.home}
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
ln -s $out/bin/jruby $out/bin/ruby
|
|
|
|
|
|
|
|
# Bundler tries to create this directory
|
|
|
|
mkdir -pv $out/${passthru.gemPath}
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
cat > $out/nix-support/setup-hook <<EOF
|
|
|
|
addGemPath() {
|
|
|
|
addToSearchPath GEM_PATH \$1/${passthru.gemPath}
|
|
|
|
}
|
|
|
|
|
|
|
|
addEnvHooks "$hostOffset" addGemPath
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2020-10-07 09:15:18 +00:00
|
|
|
postFixup = ''
|
|
|
|
PATH=$out/bin:$PATH patchShebangs $out/bin
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
passthru = rec {
|
|
|
|
rubyEngine = "jruby";
|
|
|
|
gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}";
|
|
|
|
libPath = "lib/${rubyEngine}/${rubyVersion.libDir}";
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Ruby interpreter written in Java";
|
|
|
|
homepage = "http://jruby.org/";
|
2020-08-20 17:08:02 +00:00
|
|
|
license = with licenses; [ cpl10 gpl2 lgpl21 ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.fzakaria ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in jruby.overrideAttrs (oldAttrs: {
|
|
|
|
passthru = oldAttrs.passthru // {
|
|
|
|
devEnv = callPackage ../ruby/dev.nix {
|
|
|
|
ruby = jruby;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|