nixpkgs/pkgs/development/interpreters/jruby/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

83 lines
2.1 KiB
Nix

{
lib,
stdenv,
callPackage,
fetchurl,
gitUpdater,
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.9.0";
src = fetchurl {
url = "https://s3.amazonaws.com/jruby.org/downloads/${finalAttrs.version}/jruby-bin-${finalAttrs.version}.tar.gz";
hash = "sha256-jWRzbmajwOHh6oE7YxchnF1Ddp5dBqRBcxHiuqi0Dvc=";
};
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;
};
updateScript = gitUpdater {
url = "https://github.com/jruby/jruby.git";
};
};
meta = with lib; {
description = "Ruby interpreter written in Java";
homepage = "https://www.jruby.org/";
changelog = "https://github.com/jruby/jruby/releases/tag/${finalAttrs.version}";
license = with licenses; [
cpl10
gpl2
lgpl21
];
platforms = jre.meta.platforms;
maintainers = [ maintainers.fzakaria ];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
})