Run plantuml without X (or how can I pass JAVA_OPTS to plantuml)

I have a WSL installation with the plantuml Package, which I would like to run. When I run plantuml, I get:

Exception in thread "main" java.awt.AWTError: Can't connect to X11 window se
rver using ':0' as the value of the DISPLAY variable

Googling the problem, it seems I have to give the -Djava.awt.headless=true to the jvm. So I try:

JAVA_OPTS="-Djava.awt.headless=true" plantuml

but that does not work.

I assume, that the “JAVA_OPTS” environment variable is not used by the plantum nixos wrapper (but I could be wrong).

Is there a way I could get the plantuml nixos package running without X?

Thanks!