-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The default minimal JRE in nixpkgs: - doesn't work, because it doesn't include enough modules - is based on the full JDK rather than headless, bringing in unnecessary dependencies Build our own to remedy this.
- Loading branch information
Showing
2 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
stdenv, | ||
jdk17_headless, | ||
lib, | ||
callPackage, | ||
}: let | ||
jdk = jdk17_headless; | ||
in | ||
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 | ||
mkdir modpath | ||
ln -s ${jdk}/lib/openjdk/jmods/* modpath | ||
# jpackage includes path references to the base JDK in some native binaries | ||
rm modpath/jdk.jpackage.jmod | ||
jlink --module-path modpath --add-modules ALL-MODULE-PATH --compress=2 --output $out | ||
runHook postBuild | ||
''; | ||
|
||
dontInstall = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters