about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/openjdk/jre.nix
blob: 436bd0468c52dddbbf6f882e3c8f88bef4427f25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ 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