From 5660c5f8b4a5f716f4fd1fdfee11088af4139688 Mon Sep 17 00:00:00 2001 From: Krzysztof Nazarewski <3494992+nazarewk@users.noreply.github.com> Date: Thu, 10 Mar 2022 17:13:51 +0100 Subject: [PATCH 1/2] jetty 9.4.45.v20220203 -> 11.0.8 updated because plantuml-server requires Jetty 11+ --- pkgs/servers/http/jetty/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/servers/http/jetty/default.nix b/pkgs/servers/http/jetty/default.nix index 86139e7a24f6..645abba303af 100644 --- a/pkgs/servers/http/jetty/default.nix +++ b/pkgs/servers/http/jetty/default.nix @@ -2,17 +2,17 @@ stdenv.mkDerivation rec { pname = "jetty"; - version = "9.4.45.v20220203"; + version = "11.0.8"; src = fetchurl { - url = "mirror://maven/org/eclipse/jetty/jetty-distribution/${version}/jetty-distribution-${version}.tar.gz"; - sha256 = "sha256-wmM03qAnNsiEDsLkWyJKZIb3SPCRGCxTsgKBWwopMAw="; + url = "mirror://maven/org/eclipse/jetty/jetty-home/${version}/jetty-home-${version}.tar.gz"; + sha256 = "sha256-fHd0o5f+WLdbDK1nmSnHNKjDO0mV7+vkPs4zVEaqeyw="; }; dontBuild = true; installPhase = '' mkdir -p $out - mv etc lib modules start.ini start.jar $out + mv etc lib modules start.jar $out ''; meta = with lib; { From 4ea5398d20cf110b84800e91f30a3dfce96c1b4e Mon Sep 17 00:00:00 2001 From: Krzysztof Nazarewski <3494992+nazarewk@users.noreply.github.com> Date: Wed, 9 Mar 2022 10:30:18 +0100 Subject: [PATCH 2/2] plantuml-server 1.2021.12 -> 1.2022.2 - changed JDK version to 17 (11+ required) - added maven build reproducibility --- .../services/web-apps/plantuml-server.nix | 21 +++++++++++++++--- pkgs/tools/misc/plantuml-server/default.nix | 22 ++++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/nixos/modules/services/web-apps/plantuml-server.nix b/nixos/modules/services/web-apps/plantuml-server.nix index f4bf43f56b98..9ea37b8a4cad 100644 --- a/nixos/modules/services/web-apps/plantuml-server.nix +++ b/nixos/modules/services/web-apps/plantuml-server.nix @@ -20,6 +20,21 @@ in description = "PlantUML server package to use"; }; + packages = { + jdk = mkOption { + type = types.package; + default = pkgs.jdk; + defaultText = literalExpression "pkgs.jdk"; + description = "JDK package to use for the server"; + }; + jetty = mkOption { + type = types.package; + default = pkgs.jetty; + defaultText = literalExpression "pkgs.jetty"; + description = "Jetty package to use for the server"; + }; + }; + user = mkOption { type = types.str; default = "plantuml"; @@ -105,10 +120,10 @@ in ALLOW_PLANTUML_INCLUDE = if cfg.allowPlantumlInclude then "true" else "false"; }; script = '' - ${pkgs.jre}/bin/java \ - -jar ${pkgs.jetty}/start.jar \ + ${cfg.packages.jdk}/bin/java \ + -jar ${cfg.packages.jetty}/start.jar \ --module=deploy,http,jsp \ - jetty.home=${pkgs.jetty} \ + jetty.home=${cfg.packages.jetty} \ jetty.base=${cfg.package} \ jetty.http.host=${cfg.listenHost} \ jetty.http.port=${builtins.toString cfg.listenPort} diff --git a/pkgs/tools/misc/plantuml-server/default.nix b/pkgs/tools/misc/plantuml-server/default.nix index 6afaf0fbb348..8b6c52446aa8 100644 --- a/pkgs/tools/misc/plantuml-server/default.nix +++ b/pkgs/tools/misc/plantuml-server/default.nix @@ -1,20 +1,20 @@ -{ lib, stdenv, fetchFromGitHub, maven, jdk8_headless }: +{ lib, stdenv, fetchFromGitHub, maven, jdk17_headless }: let - version = "1.2021.12"; + version = "1.2022.2"; src = fetchFromGitHub { owner = "plantuml"; repo = "plantuml-server"; rev = "v${version}"; - sha256 = "sha256:016mrs4djbaid1ma5922dvq372pphbzzmjzsjalj2dqp60538xll"; + sha256 = "sha256-55IBhulFo42jscBFrHM39qA0GRgKBoYNye4q9QkmjsM="; }; # perform fake build to make a fixed-output derivation out of the files downloaded from maven central deps = stdenv.mkDerivation { name = "plantuml-server-${version}-deps"; inherit src; - nativeBuildInputs = [ jdk8_headless maven ]; + nativeBuildInputs = [ jdk17_headless maven ]; buildPhase = '' runHook preBuild @@ -25,10 +25,12 @@ let runHook postBuild ''; # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside - installPhase = ''find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete''; + installPhase = '' + find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete + ''; outputHashAlgo = "sha256"; outputHashMode = "recursive"; - outputHash = "sha256:12w1iw9c5j7y9hhaip07j3aszjiiakkww1v3zszlj15fj8jgqyf2"; + outputHash = "sha256-AheCBX5jFzDHqTI2pCWBIiDESEKMClXlvWIcFvu0goA="; }; in @@ -37,16 +39,20 @@ stdenv.mkDerivation rec { inherit version; inherit src; - nativeBuildInputs = [ jdk8_headless maven ]; + nativeBuildInputs = [ jdk17_headless maven ]; buildPhase = '' runHook preBuild + # maven can output reproducible files after setting project.build.outputTimestamp property + # see https://maven.apache.org/guides/mini/guide-reproducible-builds.html#how-do-i-configure-my-maven-build # 'maven.repo.local' must be writable so copy it out of nix store cp -R $src repo chmod +w -R repo cd repo - mvn package --offline -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2 + mvn package --offline \ + -Dproject.build.outputTimestamp=0 \ + -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2 runHook postBuild '';