anyk: use OpenJDK with JavaFX

This commit is contained in:
Patrick Chilton 2024-10-14 21:05:39 +02:00
parent 0b49ef697b
commit d8039594c5

View File

@ -3,6 +3,7 @@
, fetchurl
, fetchzip
, openjdk
, openjfx
, writeScript
, runCommandLocal
, bash
@ -24,10 +25,16 @@ let
stripRoot = false;
};
# ÁNYK uses some SOAP stuff that's not shipped with OpenJDK any more.
# We don't really want to use openjdk8 because it's unusable on HiDPI
# and people are more likely to have a modern OpenJDK installed.
# ÁNYK needs JavaFX for the Ügyfélkapu login webview.
jdkWithFX = openjdk.override {
enableJavaFX = true;
openjfx = openjfx.override { withWebKit = true; };
};
extraClasspath = [
# ÁNYK uses some SOAP stuff that's not shipped with OpenJDK any more.
# We don't really want to use openjdk8 because it's unusable on HiDPI
# and people are more likely to have a modern OpenJDK installed.
(fetchurl {
url = "mirror://maven/org/glassfish/metro/webservices-rt/2.4.10/webservices-rt-2.4.10.jar";
sha256 = "sha256-lHclIZn3HR2B2lMttmmQGIV67qJi5KhL5jT2WNUQpPI=";
@ -43,7 +50,7 @@ let
sha256 = "sha256-ueJLfdbgdJVWLqllMb4xMMltuk144d/Yitu96/QzKHE=";
})
# Patch one of the classes so it works with the packages above by removing .internal. from the package names.
# Patch one of the ÁNYK classes so it works with the packages above by removing .internal. from the package names.
(runCommandLocal "anyk-patch" {} ''
mkdir $out
cd $out
@ -83,7 +90,7 @@ let
SCALING_PROP="-Dsun.java2d.uiScale=''${WINDOW_SCALING_FACTOR}"
fi
# ÁNYK crashes with NullPointerException with the GTK look and feel so use the cross-platform one.
exec ${openjdk}/bin/java -Dswing.systemlaf=javax.swing.plaf.metal.MetalLookAndFeel $SCALING_PROP "$@"
exec ${jdkWithFX}/bin/java -Dswing.systemlaf=javax.swing.plaf.metal.MetalLookAndFeel $SCALING_PROP "$@"
'';
in stdenv.mkDerivation {
pname = "anyk";