depot/third_party/nixpkgs/pkgs/development/compilers/openjdk/jre.nix
Default email eefb417d14 Project import generated by Copybara.
GitOrigin-RevId: a52e974cff8fb80c427e0d55c01b3b8c770ccec4
2020-11-06 01:33:48 +01:00

19 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