plantuml-server: 1.2020.14 -> 1.2021.6

This commit is contained in:
Jakob Klepp 2021-05-15 11:56:22 +02:00 committed by Jonathan Ringer
parent a5d04b89fd
commit 245070134f

View File

@ -1,30 +1,34 @@
{ lib, stdenv, fetchFromGitHub, maven, jdk }: { lib, stdenv, fetchFromGitHub, maven, jdk8_headless }:
let let
version = "1.2020.14"; version = "1.2021.6";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "plantuml"; owner = "plantuml";
repo = "plantuml-server"; repo = "plantuml-server";
rev = "v${version}"; rev = "v${version}";
sha256 = "08g6ddpkly5yhjhw7gpsanyspar1752jy9cypwxsqrdzqrv738b8"; sha256 = "sha256:1v69vabdq9pv75wzb6n5s198iy5ijfcx6lgjqwxz7n5ns3blf6sz";
}; };
# perform fake build to make a fixed-output derivation out of the files downloaded from maven central # perform fake build to make a fixed-output derivation out of the files downloaded from maven central
deps = stdenv.mkDerivation { deps = stdenv.mkDerivation {
name = "plantuml-server-${version}-deps"; name = "plantuml-server-${version}-deps";
inherit src; inherit src;
buildInputs = [ jdk maven ]; nativeBuildInputs = [ jdk8_headless maven ];
buildPhase = '' buildPhase = ''
runHook preBuild
while mvn package -Dmaven.repo.local=$out/.m2; [ $? = 1 ]; do while mvn package -Dmaven.repo.local=$out/.m2; [ $? = 1 ]; do
echo "timeout, restart maven to continue downloading" echo "timeout, restart maven to continue downloading"
done done
runHook postBuild
''; '';
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside # 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"; outputHashAlgo = "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = "1wwgyjalhlj5azggs9vvsrr54pg7gl8p36pgf6pk12rsszzl7a97"; outputHash = "sha256:1fvir7yvg4a4dc4kiv2d5q081cygj7s2lmxj90j8zzkggyq7v8zh";
}; };
in in
@ -33,25 +37,33 @@ stdenv.mkDerivation rec {
inherit version; inherit version;
inherit src; inherit src;
buildInputs = [ jdk maven ]; nativeBuildInputs = [ jdk8_headless maven ];
buildPhase = '' buildPhase = ''
runHook preBuild
# 'maven.repo.local' must be writable so copy it out of nix store # 'maven.repo.local' must be writable so copy it out of nix store
cp -R $src repo cp -R $src repo
chmod +w -R repo chmod +w -R repo
cd repo cd repo
mvn package --offline -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2 mvn package --offline -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
runHook postBuild
''; '';
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p "$out/webapps" mkdir -p "$out/webapps"
cp "target/plantuml.war" "$out/webapps/plantuml.war" cp "target/plantuml.war" "$out/webapps/plantuml.war"
runHook postInstall
''; '';
meta = with lib; { meta = with lib; {
description = "A web application to generate UML diagrams on-the-fly."; description = "A web application to generate UML diagrams on-the-fly.";
homepage = "https://plantuml.com/"; homepage = "https://plantuml.com/";
license = licenses.gpl3; license = licenses.gpl3Plus;
platforms = platforms.all; platforms = platforms.all;
maintainers = with maintainers; [ truh ]; maintainers = with maintainers; [ truh ];
}; };