at 22.05-pre 67 lines 1.8 kB view raw
1{ lib, stdenv, callPackage, fetchurl, makeWrapper, jre }: 2 3let 4# The version number here is whatever is reported by the RUBY_VERSION string 5rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "5" "7" ""; 6jruby = stdenv.mkDerivation rec { 7 pname = "jruby"; 8 9 version = "9.2.19.0"; 10 11 src = fetchurl { 12 url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz"; 13 sha256 = "sha256-H3SIWi0/pYn8vrKSo5+s9/hr4+rBqwFeMsZdMqzz878="; 14 }; 15 16 nativeBuildInputs = [ makeWrapper ]; 17 18 installPhase = '' 19 mkdir -pv $out/docs 20 mv * $out 21 rm $out/bin/*.{bat,dll,exe,sh} 22 mv $out/COPYING $out/LICENSE* $out/docs 23 24 for i in $out/bin/jruby{,.bash}; do 25 wrapProgram $i \ 26 --set JAVA_HOME ${jre.home} 27 done 28 29 ln -s $out/bin/jruby $out/bin/ruby 30 31 # Bundler tries to create this directory 32 mkdir -pv $out/${passthru.gemPath} 33 mkdir -p $out/nix-support 34 cat > $out/nix-support/setup-hook <<EOF 35 addGemPath() { 36 addToSearchPath GEM_PATH \$1/${passthru.gemPath} 37 } 38 39 addEnvHooks "$hostOffset" addGemPath 40 EOF 41 ''; 42 43 postFixup = '' 44 PATH=$out/bin:$PATH patchShebangs $out/bin 45 ''; 46 47 passthru = rec { 48 rubyEngine = "jruby"; 49 gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}"; 50 libPath = "lib/${rubyEngine}/${rubyVersion.libDir}"; 51 }; 52 53 meta = with lib; { 54 description = "Ruby interpreter written in Java"; 55 homepage = "http://jruby.org/"; 56 license = with licenses; [ cpl10 gpl2 lgpl21 ]; 57 platforms = platforms.unix; 58 maintainers = [ maintainers.fzakaria ]; 59 }; 60}; 61in jruby.overrideAttrs (oldAttrs: { 62 passthru = oldAttrs.passthru // { 63 devEnv = callPackage ../ruby/dev.nix { 64 ruby = jruby; 65 }; 66 }; 67})