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

68 lines
1.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, callPackage, fetchurl, makeWrapper, jre }:
let
# The version number here is whatever is reported by the RUBY_VERSION string
2020-08-04 19:33:27 +01:00
rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "5" "7" "";
jruby = stdenv.mkDerivation rec {
pname = "jruby";
2014-04-22 18:00:09 +01:00
2021-03-08 13:57:28 +00:00
version = "9.2.16.0";
src = fetchurl {
2016-02-11 23:31:41 +00:00
url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz";
2021-03-08 13:57:28 +00:00
sha256 = "sha256-WuJ/FJ9z8/6k80NZy7dzwl2dmH5yte3snouTlXmX6zA=";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
2016-02-11 23:31:41 +00:00
mkdir -pv $out/docs
mv * $out
rm $out/bin/*.{bat,dll,exe,sh}
2014-04-22 18:00:09 +01:00
mv $out/COPYING $out/LICENSE* $out/docs
for i in $out/bin/jruby{,.bash}; do
wrapProgram $i \
--set JAVA_HOME ${jre.home}
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
'';
postFixup = ''
PATH=$out/bin:$PATH patchShebangs $out/bin
'';
passthru = rec {
rubyEngine = "jruby";
gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}";
libPath = "lib/${rubyEngine}/${rubyVersion.libDir}";
};
meta = with lib; {
description = "Ruby interpreter written in Java";
2020-03-05 02:42:20 +00:00
homepage = "http://jruby.org/";
2020-07-17 23:01:27 +01:00
license = with licenses; [ cpl10 gpl2 lgpl21 ];
platforms = platforms.unix;
maintainers = [ maintainers.fzakaria ];
};
};
in jruby.overrideAttrs (oldAttrs: {
passthru = oldAttrs.passthru // {
devEnv = callPackage ../ruby/dev.nix {
ruby = jruby;
};
};
})