1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-16 18:03:22 +00:00
nixpkgs/pkgs/development/compilers/openjdk/jre.nix
Arnout Engelen d4efa08b53
openjdk: add derivation to generate bespoke minimal JRE's
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2020-11-04 17:47:18 +01:00

20 lines
468 B
Nix

{ jdk
, runCommand
, patchelf
, lib
, modules ? [ "java.base" ]
}:
let
jre = runCommand "${jdk.name}-jre" {
nativeBuildInputs = [ patchelf ];
buildInputs = [ jdk ];
passthru = {
home = "${jre}";
};
} ''
jlink --module-path ${jdk}/lib/openjdk/jmods --add-modules ${lib.concatStringsSep "," modules} --output $out
patchelf --shrink-rpath $out/bin/* $out/lib/jexec $out/lib/jspawnhelper $out/lib/*.so $out/lib/*/*.so
'';
in jre