Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plantuml-server 1.2021.12 -> 1.2022.2 #163431

Merged
merged 2 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions nixos/modules/services/web-apps/plantuml-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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}
Expand Down
8 changes: 4 additions & 4 deletions pkgs/servers/http/jetty/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; {
Expand Down
22 changes: 14 additions & 8 deletions pkgs/tools/misc/plantuml-server/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -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
'';
Expand Down