Merge pull request #98383 from raboof/document-jre

openjdk: add derivation to generate bespoke minimal JRE's
This commit is contained in:
Robert Hensing
2020-11-05 10:40:39 +01:00
committed by GitHub
3 changed files with 45 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
{ 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