Merge pull request #163431 from nazarewk/update-plantuml-server

plantuml-server 1.2021.12 -> 1.2022.2
This commit is contained in:
Luke Granger-Brown 2022-03-14 13:37:49 +00:00 committed by GitHub
commit 247a1809a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 15 deletions

View file

@ -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}

View file

@ -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; {

View file

@ -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
'';