2021-03-09 13:24:03 +01:00
|
|
|
{ stdenv
|
|
|
|
, jdk
|
2020-09-19 13:30:09 +02:00
|
|
|
, lib
|
2021-04-28 17:19:19 +02:00
|
|
|
, callPackage
|
2020-09-19 13:30:09 +02:00
|
|
|
, modules ? [ "java.base" ]
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-03-09 13:24:03 +01:00
|
|
|
jre = stdenv.mkDerivation {
|
|
|
|
name = "${jdk.name}-minimal-jre";
|
|
|
|
version = jdk.version;
|
|
|
|
|
2020-09-19 13:30:09 +02:00
|
|
|
buildInputs = [ jdk ];
|
2021-03-09 13:24:03 +01: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 13:30:09 +02:00
|
|
|
passthru = {
|
|
|
|
home = "${jre}";
|
2021-04-28 17:19:19 +02:00
|
|
|
tests = [
|
|
|
|
(callPackage ./tests/test_jre_minimal.nix {})
|
|
|
|
(callPackage ./tests/test_jre_minimal_with_logging.nix {})
|
|
|
|
];
|
2020-09-19 13:30:09 +02:00
|
|
|
};
|
2021-03-09 13:24:03 +01:00
|
|
|
};
|
2020-09-19 13:30:09 +02:00
|
|
|
in jre
|