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