about summary refs log tree commit diff
path: root/doc/languages-frameworks/java.section.md
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2024-03-27 19:10:27 +0100
committerValentin Gagarin <valentin.gagarin@tweag.io>2024-03-28 09:28:12 +0100
commitfcc95ff8172cc68a0d2d52aa1e8ef2120d2904ec (patch)
tree8de1a02f7d1624c97562c7736896a6c95c74ec04 /doc/languages-frameworks/java.section.md
parentbc77c7a9730833c7668c92288c6af950e7270cb5 (diff)
downloadnixlib-fcc95ff8172cc68a0d2d52aa1e8ef2120d2904ec.tar
nixlib-fcc95ff8172cc68a0d2d52aa1e8ef2120d2904ec.tar.gz
nixlib-fcc95ff8172cc68a0d2d52aa1e8ef2120d2904ec.tar.bz2
nixlib-fcc95ff8172cc68a0d2d52aa1e8ef2120d2904ec.tar.lz
nixlib-fcc95ff8172cc68a0d2d52aa1e8ef2120d2904ec.tar.xz
nixlib-fcc95ff8172cc68a0d2d52aa1e8ef2120d2904ec.tar.zst
nixlib-fcc95ff8172cc68a0d2d52aa1e8ef2120d2904ec.zip
treewide: Fix all Nix ASTs in all markdown files
This allows for correct highlighting and maybe future automatic
formatting. The AST was verified to work with nixfmt only.
Diffstat (limited to 'doc/languages-frameworks/java.section.md')
-rw-r--r--doc/languages-frameworks/java.section.md36
1 files changed, 22 insertions, 14 deletions
diff --git a/doc/languages-frameworks/java.section.md b/doc/languages-frameworks/java.section.md
index 0ce1442cca68..2c73d428cab3 100644
--- a/doc/languages-frameworks/java.section.md
+++ b/doc/languages-frameworks/java.section.md
@@ -7,7 +7,7 @@ stdenv.mkDerivation {
   pname = "...";
   version = "...";
 
-  src = fetchurl { ... };
+  src = fetchurl { /* ... */ };
 
   nativeBuildInputs = [
     ant
@@ -48,8 +48,10 @@ installs a JAR named `foo.jar` in its `share/java` directory, and
 another package declares the attribute
 
 ```nix
-buildInputs = [ libfoo ];
-nativeBuildInputs = [ jdk ];
+{
+  buildInputs = [ libfoo ];
+  nativeBuildInputs = [ jdk ];
+}
 ```
 
 then `CLASSPATH` will be set to
@@ -62,13 +64,15 @@ If your Java package provides a program, you need to generate a wrapper
 script to run it using a JRE. You can use `makeWrapper` for this:
 
 ```nix
-nativeBuildInputs = [ makeWrapper ];
+{
+  nativeBuildInputs = [ makeWrapper ];
 
-installPhase = ''
-  mkdir -p $out/bin
-  makeWrapper ${jre}/bin/java $out/bin/foo \
-    --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
-'';
+  installPhase = ''
+    mkdir -p $out/bin
+    makeWrapper ${jre}/bin/java $out/bin/foo \
+      --add-flags "-cp $out/share/java/foo.jar org.foo.Main"
+  '';
+}
 ```
 
 Since the introduction of the Java Platform Module System in Java 9,
@@ -92,16 +96,18 @@ let
   something = (pkgs.something.override { jre = my_jre; });
   other = (pkgs.other.override { jre = my_jre; });
 in
-  ...
+  "..."
 ```
 
 You can also specify what JDK your JRE should be based on, for example
 selecting a 'headless' build to avoid including a link to GTK+:
 
 ```nix
-my_jre = pkgs.jre_minimal.override {
-  jdk = jdk11_headless;
-};
+{
+  my_jre = pkgs.jre_minimal.override {
+    jdk = jdk11_headless;
+  };
+}
 ```
 
 Note all JDKs passthru `home`, so if your application requires
@@ -116,7 +122,9 @@ It is possible to use a different Java compiler than `javac` from the
 OpenJDK. For instance, to use the GNU Java Compiler:
 
 ```nix
-nativeBuildInputs = [ gcj ant ];
+{
+  nativeBuildInputs = [ gcj ant ];
+}
 ```
 
 Here, Ant will automatically use `gij` (the GNU Java Runtime) instead of