nixpkgs-suyu/pkgs/development/interpreters/jruby/default.nix

63 lines
1.6 KiB
Nix
Raw Normal View History

{ stdenv, callPackage, fetchurl, makeWrapper, jre }:
let
# The version number here is whatever is reported by the RUBY_VERSION string
rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "3" "3" "";
jruby = stdenv.mkDerivation rec {
pname = "jruby";
2014-04-22 19:00:09 +02:00
2020-04-06 00:06:39 +02:00
version = "9.2.11.1";
src = fetchurl {
2016-02-12 00:31:41 +01:00
url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz";
2020-04-06 00:06:39 +02:00
sha256 = "1p4ml5rqidqllc7z85zn2q4pyyih71j0gb71wl43j4v74p44j17i";
};
buildInputs = [ makeWrapper ];
installPhase = ''
2016-02-12 00:31:41 +01:00
mkdir -pv $out/docs
mv * $out
rm $out/bin/*.{bat,dll,exe,sh}
2014-04-22 19:00:09 +02:00
mv $out/COPYING $out/LICENSE* $out/docs
for i in $out/bin/jruby{,.bash}; do
wrapProgram $i \
--set JAVA_HOME ${jre}
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
'';
passthru = rec {
rubyEngine = "jruby";
gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}";
libPath = "lib/${rubyEngine}/${rubyVersion.libDir}";
};
2014-04-22 19:00:09 +02:00
meta = {
description = "Ruby interpreter written in Java";
2020-03-05 03:42:20 +01:00
homepage = "http://jruby.org/";
license = with stdenv.lib.licenses; [ cpl10 gpl2 lgpl21 ];
platforms = stdenv.lib.platforms.unix;
};
};
in jruby.overrideAttrs (oldAttrs: {
passthru = oldAttrs.passthru // {
devEnv = callPackage ../ruby/dev.nix {
ruby = jruby;
};
};
})