blob: 7c329f56fedc92d05976e360d5a7c6f20c2b0aca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
{ lib, stdenv, callPackage, fetchurl, mkRubyVersion, makeBinaryWrapper, jre }:
let
# The version number here is whatever is reported by the RUBY_VERSION string
rubyVersion = mkRubyVersion "3" "1" "4" "";
in
stdenv.mkDerivation (finalAttrs: {
pname = "jruby";
version = "9.4.3.0";
src = fetchurl {
url = "https://s3.amazonaws.com/jruby.org/downloads/${finalAttrs.version}/jruby-bin-${finalAttrs.version}.tar.gz";
hash = "sha256-sJfgjFZp6KGIKI4RORHRK0rSvWeiwgnW36hEXWOk2Mk=";
};
nativeBuildInputs = [ makeBinaryWrapper ];
installPhase = ''
mkdir -pv $out/share/jruby/docs
mv * $out
rm $out/bin/*.{bat,dll,exe,sh}
mv $out/samples $out/share/jruby/
mv $out/BSDL $out/COPYING $out/LEGAL $out/LICENSE* $out/share/jruby/docs/
for i in $out/bin/jruby; 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/${finalAttrs.passthru.gemPath}
mkdir -p $out/nix-support
cat > $out/nix-support/setup-hook <<EOF
addGemPath() {
addToSearchPath GEM_PATH \$1/${finalAttrs.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}";
devEnv = callPackage ../ruby/dev.nix {
ruby = finalAttrs.finalPackage;
};
};
meta = with lib; {
description = "Ruby interpreter written in Java";
homepage = "https://www.jruby.org/";
changelog = "https://github.com/jruby/jruby/releases/tag/${version}";
license = with licenses; [ cpl10 gpl2 lgpl21 ];
platforms = jre.meta.platforms;
maintainers = [ maintainers.fzakaria ];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
})
|