nixpkgs/pkgs/development/compilers/openjdk/jre.nix

40 lines
813 B
Nix
Raw Normal View History

{ stdenv
, jdk
, lib
2021-04-28 15:19:19 +00:00
, callPackage
, modules ? [ "java.base" ]
}:
let
jre = stdenv.mkDerivation {
2022-03-01 10:39:32 +00:00
pname = "${jdk.pname}-minimal-jre";
version = jdk.version;
buildInputs = [ jdk ];
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;
passthru = {
home = "${jre}";
2021-04-28 15:19:19 +00:00
tests = [
(callPackage ./tests/test_jre_minimal.nix {})
(callPackage ./tests/test_jre_minimal_with_logging.nix {})
];
};
};
in jre