2021-03-09 12:24:03 +00:00
|
|
|
{ stdenv
|
|
|
|
, jdk
|
2020-09-19 12:30:09 +01:00
|
|
|
, lib
|
2021-04-28 16:19:19 +01:00
|
|
|
, callPackage
|
2020-09-19 12:30:09 +01:00
|
|
|
, modules ? [ "java.base" ]
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-03-09 12:24:03 +00:00
|
|
|
jre = stdenv.mkDerivation {
|
|
|
|
name = "${jdk.name}-minimal-jre";
|
|
|
|
version = jdk.version;
|
|
|
|
|
2020-09-19 12:30:09 +01:00
|
|
|
buildInputs = [ jdk ];
|
2021-03-09 12:24:03 +00:00
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
# Strip more heavily than the default '-S', since if you're
|
|
|
|
# using this derivation you probably care about this.
|
|
|
|
stripDebugFlags = [ "--strip-unneeded" ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
jlink --module-path ${jdk}/lib/openjdk/jmods --add-modules ${lib.concatStringsSep "," modules} --output $out
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontInstall = true;
|
|
|
|
|
2020-09-19 12:30:09 +01:00
|
|
|
passthru = {
|
|
|
|
home = "${jre}";
|
2021-04-28 16:19:19 +01:00
|
|
|
tests = [
|
|
|
|
(callPackage ./tests/test_jre_minimal.nix {})
|
|
|
|
(callPackage ./tests/test_jre_minimal_with_logging.nix {})
|
|
|
|
];
|
2020-09-19 12:30:09 +01:00
|
|
|
};
|
2021-03-09 12:24:03 +00:00
|
|
|
};
|
2020-09-19 12:30:09 +01:00
|
|
|
in jre
|