mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
jruby: Use finalAttrs pattern
This commit is contained in:
parent
76a2ed5ef5
commit
671243193c
@ -1,44 +1,44 @@
|
||||
{ lib, stdenv, callPackage, fetchurl, makeBinaryWrapper, jre }:
|
||||
{ lib, stdenv, callPackage, fetchurl, mkRubyVersion, makeBinaryWrapper, jre }:
|
||||
|
||||
let
|
||||
# The version number here is whatever is reported by the RUBY_VERSION string
|
||||
rubyVersion = callPackage ../ruby/ruby-version.nix {} "3" "1" "4" "";
|
||||
jruby = stdenv.mkDerivation rec {
|
||||
# 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/${version}/jruby-bin-${version}.tar.gz";
|
||||
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/
|
||||
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
|
||||
for i in $out/bin/jruby; do
|
||||
wrapProgram $i \
|
||||
--set JAVA_HOME ${jre.home}
|
||||
done
|
||||
|
||||
ln -s $out/bin/jruby $out/bin/ruby
|
||||
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}
|
||||
}
|
||||
# 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
|
||||
addEnvHooks "$hostOffset" addGemPath
|
||||
EOF
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
@ -49,6 +49,9 @@ jruby = stdenv.mkDerivation 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; {
|
||||
@ -60,11 +63,4 @@ jruby = stdenv.mkDerivation rec {
|
||||
maintainers = [ maintainers.fzakaria ];
|
||||
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
||||
};
|
||||
};
|
||||
in jruby.overrideAttrs (oldAttrs: {
|
||||
passthru = oldAttrs.passthru // {
|
||||
devEnv = callPackage ../ruby/dev.nix {
|
||||
ruby = jruby;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user