diff --git a/pkgs/development/compilers/openjdk/jre.nix b/pkgs/development/compilers/openjdk/jre.nix index 2370774cef29..9e9498f4d6dc 100644 --- a/pkgs/development/compilers/openjdk/jre.nix +++ b/pkgs/development/compilers/openjdk/jre.nix @@ -7,38 +7,43 @@ modules ? [ "java.base" ], }: -let - jre = stdenv.mkDerivation { - pname = "${jdk.pname}-minimal-jre"; - version = jdk.version; +stdenv.mkDerivation (finalAttrs: { + pname = "${jdk.pname}-minimal-jre"; + version = jdk.version; - nativeBuildInputs = [ jdkOnBuild ]; - buildInputs = [ jdk ]; - strictDeps = true; + nativeBuildInputs = [ jdkOnBuild ]; + buildInputs = [ jdk ]; + strictDeps = true; - dontUnpack = true; + dontUnpack = true; - # Strip more heavily than the default '-S', since if you're - # using this derivation you probably care about this. - stripDebugFlags = [ "--strip-unneeded" ]; + # 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 + buildPhase = '' + runHook preBuild - jlink --module-path ${jdk}/lib/openjdk/jmods --add-modules ${lib.concatStringsSep "," modules} --output $out + jlink --module-path ${jdk}/lib/openjdk/jmods --add-modules ${lib.concatStringsSep "," modules} --output $out - runHook postBuild - ''; + runHook postBuild + ''; - dontInstall = true; + dontInstall = true; - passthru = { - home = "${jre}"; - tests = { - jre_minimal-hello = callPackage ./tests/test_jre_minimal.nix { }; - jre_minimal-hello-logging = callPackage ./tests/test_jre_minimal_with_logging.nix { }; - }; + passthru = { + home = "${finalAttrs.finalPackage}"; + tests = { + jre_minimal-hello = callPackage ./tests/test_jre_minimal.nix { }; + jre_minimal-hello-logging = callPackage ./tests/test_jre_minimal_with_logging.nix { }; }; }; -in -jre + + meta = jdk.meta // { + description = "Minimal JRE for OpenJDK ${jdk.version}"; + longDescription = '' + This is a minimal JRE built from OpenJDK, containing only the specified modules. + It is suitable for running Java applications that do not require the full JDK. + ''; + }; +})