Skip to content

Commit 80f8346

Browse files
committed
nix: Reduce the closure size by using a minimal JRE
Apparently, there is no more canonical JRE because `pkgs.jre` is an alias for `pkgs.jdk`. However, nixpkgs provides `jre_minimal` which can be used to exclude unused modules. I created the list of used modules by running the ESEC/FSE 2024 demo and adding modules until it stopped complaining.
1 parent 4b98467 commit 80f8346

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

default.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ pkgs.stdenvNoCC.mkDerivation rec {
5959
outputHash = "sha256-Gimt6L54yyaX3BtdhQlVu1j4c4y++Mip0GzMl/IfzMc=";
6060
};
6161

62+
jre-minimal = pkgs.callPackage (import "${sources.nixpkgs}/pkgs/development/compilers/openjdk/jre.nix") {
63+
modules = ["java.base" "java.desktop"];
64+
};
65+
6266
buildPhase = ''
6367
runHook preBuild
6468
@@ -96,7 +100,7 @@ pkgs.stdenvNoCC.mkDerivation rec {
96100
97101
local jar="$out/share/java/DiffDetective/DiffDetective.jar"
98102
install -Dm644 "target/diffdetective-${version}-jar-with-dependencies.jar" "$jar"
99-
makeWrapper "${pkgs.jdk}/bin/java" "$out/bin/DiffDetective" --add-flags "-cp \"$jar\"" \
103+
makeWrapper "${jre-minimal}/bin/java" "$out/bin/DiffDetective" --add-flags "-cp \"$jar\"" \
100104
--prefix PATH : "${pkgs.graphviz}/bin"
101105
102106
${

0 commit comments

Comments
 (0)