nixpkgs/pkgs/development/compilers/openjdk/jre.nix
Arnout Engelen d3e9040686
jre_minimal: strip libraries
runCommand doesn't invoke the automatic stripping from stdenv,
expanding the derivation like this does.

Fixes #115486
2021-03-11 14:27:02 +01:00

35 lines
651 B
Nix

{ stdenv
, jdk
, lib
, modules ? [ "java.base" ]
}:
let
jre = stdenv.mkDerivation {
name = "${jdk.name}-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}";
};
};
in jre