depot/pkgs/development/compilers/openjdk/jre.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

39 lines
859 B
Nix

{ stdenv
, jdk
, lib
, callPackage
, modules ? [ "java.base" ]
}:
let
jre = stdenv.mkDerivation {
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}";
tests = {
jre_minimal-hello = callPackage ./tests/test_jre_minimal.nix {};
jre_minimal-hello-logging = callPackage ./tests/test_jre_minimal_with_logging.nix {};
};
};
};
in jre