Loading doc/languages-frameworks/java.section.md +26 −3 Original line number Diff line number Diff line Loading @@ -4,12 +4,31 @@ Ant-based Java packages are typically built from source as follows: ```nix stdenv.mkDerivation { name = "..."; pname = "..."; version = "..."; src = fetchurl { ... }; nativeBuildInputs = [ jdk ant ]; nativeBuildInputs = [ ant jdk stripJavaArchivesHook # removes timestamp metadata from jar files ]; buildPhase = "ant"; buildPhase = '' runHook preBuild ant # build the project using ant runHook postBuild ''; installPhase = '' runHook preInstall # copy generated jar file(s) to an appropriate location in $out install -Dm644 build/foo.jar $out/share/java/foo.jar runHook postInstall ''; } ``` Loading @@ -17,6 +36,10 @@ Note that `jdk` is an alias for the OpenJDK (self-built where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in Nixpkgs (`Aarch32`, `Aarch64`) point to the (unfree) `oraclejdk`. Also note that not using `stripJavaArchivesHook` will likely cause the generated `.jar` files to be non-deterministic, which is not optimal. Using it, however, does not always guarantee reproducibility. JAR files that are intended to be used by other packages should be installed in `$out/share/java`. JDKs have a stdenv setup hook that add any JARs in the `share/java` directories of the build inputs to the Loading pkgs/applications/blockchains/bisq-desktop/default.nix +2 −3 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ , dpkg , writeScript , bash , strip-nondeterminism , stripJavaArchivesHook , tor , zip , xz Loading Loading @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { dpkg imagemagick makeWrapper strip-nondeterminism stripJavaArchivesHook xz zip findutils Loading Loading @@ -89,7 +89,6 @@ stdenv.mkDerivation rec { tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" -cJf native/linux/x64/tor.tar.xz tor tor_jar_file=$(find ./opt/bisq/lib/app -name "tor-binary-linux64-*.jar") zip -r $tor_jar_file native strip-nondeterminism ./opt/bisq/lib/app/*.jar ''; installPhase = '' Loading pkgs/applications/misc/calcoo/default.nix +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ , stdenv , fetchzip , ant , canonicalize-jars-hook , stripJavaArchivesHook , jdk , makeWrapper }: Loading @@ -18,7 +18,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ ant canonicalize-jars-hook stripJavaArchivesHook jdk makeWrapper ]; Loading pkgs/applications/misc/mkgmap/default.nix +2 −5 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ , jre , ant , makeWrapper , stripJavaArchivesHook , doCheck ? true , withExamples ? false }: Loading @@ -30,10 +31,6 @@ stdenv.mkDerivation rec { ]; postPatch = with deps; '' # Fix the output jar timestamps for reproducibility substituteInPlace build.xml \ --replace-fail '<jar ' '<jar modificationtime="0" ' # Manually create version properties file for reproducibility mkdir -p build/classes cat > build/classes/mkgmap-version.properties << EOF Loading Loading @@ -61,7 +58,7 @@ stdenv.mkDerivation rec { '') testInputs} ''; nativeBuildInputs = [ jdk ant makeWrapper ]; nativeBuildInputs = [ jdk ant makeWrapper stripJavaArchivesHook ]; buildPhase = '' runHook preBuild Loading pkgs/applications/misc/mkgmap/splitter/default.nix +2 −5 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ , jre , ant , makeWrapper , stripJavaArchivesHook , doCheck ? true }: let Loading @@ -30,10 +31,6 @@ stdenv.mkDerivation rec { ]; postPatch = with deps; '' # Fix the output jar timestamps for reproducibility substituteInPlace build.xml \ --replace-fail '<jar ' '<jar modificationtime="0" ' # Manually create version properties file for reproducibility mkdir -p build/classes cat > build/classes/splitter-version.properties << EOF Loading @@ -58,7 +55,7 @@ stdenv.mkDerivation rec { '') testInputs} ''; nativeBuildInputs = [ jdk ant makeWrapper ]; nativeBuildInputs = [ jdk ant makeWrapper stripJavaArchivesHook ]; buildPhase = '' runHook preBuild Loading Loading
doc/languages-frameworks/java.section.md +26 −3 Original line number Diff line number Diff line Loading @@ -4,12 +4,31 @@ Ant-based Java packages are typically built from source as follows: ```nix stdenv.mkDerivation { name = "..."; pname = "..."; version = "..."; src = fetchurl { ... }; nativeBuildInputs = [ jdk ant ]; nativeBuildInputs = [ ant jdk stripJavaArchivesHook # removes timestamp metadata from jar files ]; buildPhase = "ant"; buildPhase = '' runHook preBuild ant # build the project using ant runHook postBuild ''; installPhase = '' runHook preInstall # copy generated jar file(s) to an appropriate location in $out install -Dm644 build/foo.jar $out/share/java/foo.jar runHook postInstall ''; } ``` Loading @@ -17,6 +36,10 @@ Note that `jdk` is an alias for the OpenJDK (self-built where available, or pre-built via Zulu). Platforms with OpenJDK not (yet) in Nixpkgs (`Aarch32`, `Aarch64`) point to the (unfree) `oraclejdk`. Also note that not using `stripJavaArchivesHook` will likely cause the generated `.jar` files to be non-deterministic, which is not optimal. Using it, however, does not always guarantee reproducibility. JAR files that are intended to be used by other packages should be installed in `$out/share/java`. JDKs have a stdenv setup hook that add any JARs in the `share/java` directories of the build inputs to the Loading
pkgs/applications/blockchains/bisq-desktop/default.nix +2 −3 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ , dpkg , writeScript , bash , strip-nondeterminism , stripJavaArchivesHook , tor , zip , xz Loading Loading @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { dpkg imagemagick makeWrapper strip-nondeterminism stripJavaArchivesHook xz zip findutils Loading Loading @@ -89,7 +89,6 @@ stdenv.mkDerivation rec { tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" -cJf native/linux/x64/tor.tar.xz tor tor_jar_file=$(find ./opt/bisq/lib/app -name "tor-binary-linux64-*.jar") zip -r $tor_jar_file native strip-nondeterminism ./opt/bisq/lib/app/*.jar ''; installPhase = '' Loading
pkgs/applications/misc/calcoo/default.nix +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ , stdenv , fetchzip , ant , canonicalize-jars-hook , stripJavaArchivesHook , jdk , makeWrapper }: Loading @@ -18,7 +18,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ ant canonicalize-jars-hook stripJavaArchivesHook jdk makeWrapper ]; Loading
pkgs/applications/misc/mkgmap/default.nix +2 −5 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ , jre , ant , makeWrapper , stripJavaArchivesHook , doCheck ? true , withExamples ? false }: Loading @@ -30,10 +31,6 @@ stdenv.mkDerivation rec { ]; postPatch = with deps; '' # Fix the output jar timestamps for reproducibility substituteInPlace build.xml \ --replace-fail '<jar ' '<jar modificationtime="0" ' # Manually create version properties file for reproducibility mkdir -p build/classes cat > build/classes/mkgmap-version.properties << EOF Loading Loading @@ -61,7 +58,7 @@ stdenv.mkDerivation rec { '') testInputs} ''; nativeBuildInputs = [ jdk ant makeWrapper ]; nativeBuildInputs = [ jdk ant makeWrapper stripJavaArchivesHook ]; buildPhase = '' runHook preBuild Loading
pkgs/applications/misc/mkgmap/splitter/default.nix +2 −5 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ , jre , ant , makeWrapper , stripJavaArchivesHook , doCheck ? true }: let Loading @@ -30,10 +31,6 @@ stdenv.mkDerivation rec { ]; postPatch = with deps; '' # Fix the output jar timestamps for reproducibility substituteInPlace build.xml \ --replace-fail '<jar ' '<jar modificationtime="0" ' # Manually create version properties file for reproducibility mkdir -p build/classes cat > build/classes/splitter-version.properties << EOF Loading @@ -58,7 +55,7 @@ stdenv.mkDerivation rec { '') testInputs} ''; nativeBuildInputs = [ jdk ant makeWrapper ]; nativeBuildInputs = [ jdk ant makeWrapper stripJavaArchivesHook ]; buildPhase = '' runHook preBuild Loading