Merge pull request #27273 from asppsa/jruby-gem-fix
jruby: changes to make it possible to use in development environment
This commit is contained in:
commit
4af15b5b4a
@ -1,6 +1,9 @@
|
||||
{ stdenv, fetchurl, makeWrapper, jre }:
|
||||
{ stdenv, callPackage, fetchurl, makeWrapper, jre }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
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 {
|
||||
name = "jruby-${version}";
|
||||
|
||||
version = "9.1.12.0";
|
||||
@ -18,16 +21,42 @@ stdenv.mkDerivation rec {
|
||||
rm $out/bin/*.{bat,dll,exe,sh}
|
||||
mv $out/COPYING $out/LICENSE* $out/docs
|
||||
|
||||
for i in $out/bin/*; do
|
||||
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}
|
||||
}
|
||||
|
||||
envHooks+=(addGemPath)
|
||||
EOF
|
||||
'';
|
||||
|
||||
passthru = rec {
|
||||
rubyEngine = "jruby";
|
||||
gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}";
|
||||
libPath = "lib/${rubyEngine}/${rubyVersion.libDir}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Ruby interpreter written in Java";
|
||||
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;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
@ -1,8 +1,8 @@
|
||||
{ buildRubyGem, fetchFromGitHub, makeWrapper, lib, bundler, ruby, nix,
|
||||
{ buildRubyGem, fetchFromGitHub, makeWrapper, lib, bundler, nix,
|
||||
nix-prefetch-git }:
|
||||
|
||||
buildRubyGem rec {
|
||||
inherit ruby;
|
||||
inherit (bundler) ruby;
|
||||
|
||||
name = "${gemName}-${version}";
|
||||
gemName = "bundix";
|
||||
|
Loading…
Reference in New Issue
Block a user