mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
Merge pull request #92582 from truh/plantuml-server-squash
This commit is contained in:
commit
749c9f1f19
5 changed files with 190 additions and 0 deletions
|
@ -9081,6 +9081,12 @@
|
|||
githubId = 483735;
|
||||
name = "Dmitry Geurkov";
|
||||
};
|
||||
truh = {
|
||||
email = "jakob-nixos@truh.in";
|
||||
github = "truh";
|
||||
githubId = 1183303;
|
||||
name = "Jakob Klepp";
|
||||
};
|
||||
tscholak = {
|
||||
email = "torsten.scholak@googlemail.com";
|
||||
github = "tscholak";
|
||||
|
|
|
@ -876,6 +876,7 @@
|
|||
./services/web-apps/moodle.nix
|
||||
./services/web-apps/nextcloud.nix
|
||||
./services/web-apps/nexus.nix
|
||||
./services/web-apps/plantuml-server.nix
|
||||
./services/web-apps/pgpkeyserver-lite.nix
|
||||
./services/web-apps/matomo.nix
|
||||
./services/web-apps/moinmoin.nix
|
||||
|
|
123
nixos/modules/services/web-apps/plantuml-server.nix
Normal file
123
nixos/modules/services/web-apps/plantuml-server.nix
Normal file
|
@ -0,0 +1,123 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.plantuml-server;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
services.plantuml-server = {
|
||||
enable = mkEnableOption "PlantUML server";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.plantuml-server;
|
||||
description = "PlantUML server package to use";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "plantuml";
|
||||
description = "User which runs PlantUML server.";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = types.str;
|
||||
default = "plantuml";
|
||||
description = "Group which runs PlantUML server.";
|
||||
};
|
||||
|
||||
home = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/lib/plantuml";
|
||||
description = "Home directory of the PlantUML server instance.";
|
||||
};
|
||||
|
||||
listenHost = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
description = "Host to listen on.";
|
||||
};
|
||||
|
||||
listenPort = mkOption {
|
||||
type = types.int;
|
||||
default = 8080;
|
||||
description = "Port to listen on.";
|
||||
};
|
||||
|
||||
plantumlLimitSize = mkOption {
|
||||
type = types.int;
|
||||
default = 4096;
|
||||
description = "Limits image width and height.";
|
||||
};
|
||||
|
||||
graphvizPackage = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.graphviz_2_32;
|
||||
description = "Package containing the dot executable.";
|
||||
};
|
||||
|
||||
plantumlStats = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Set it to on to enable statistics report (https://plantuml.com/statistics-report).";
|
||||
};
|
||||
|
||||
httpAuthorization = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "When calling the proxy endpoint, the value of HTTP_AUTHORIZATION will be used to set the HTTP Authorization header.";
|
||||
};
|
||||
|
||||
allowPlantumlInclude = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enables !include processing which can read files from the server into diagrams. Files are read relative to the current working directory.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.users.${cfg.user} = {
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
home = cfg.home;
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
users.groups.${cfg.group} = {};
|
||||
|
||||
systemd.services.plantuml-server = {
|
||||
description = "PlantUML server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
path = [ cfg.home ];
|
||||
environment = {
|
||||
PLANTUML_LIMIT_SIZE = builtins.toString cfg.plantumlLimitSize;
|
||||
GRAPHVIZ_DOT = "${cfg.graphvizPackage}/bin/dot";
|
||||
PLANTUML_STATS = if cfg.plantumlStats then "on" else "off";
|
||||
HTTP_AUTHORIZATION = cfg.httpAuthorization;
|
||||
ALLOW_PLANTUML_INCLUDE = if cfg.allowPlantumlInclude then "true" else "false";
|
||||
};
|
||||
script = ''
|
||||
${pkgs.jre}/bin/java \
|
||||
-jar ${pkgs.jetty}/start.jar \
|
||||
--module=deploy,http,jsp \
|
||||
jetty.home=${pkgs.jetty} \
|
||||
jetty.base=${cfg.package} \
|
||||
jetty.http.host=${cfg.listenHost} \
|
||||
jetty.http.port=${builtins.toString cfg.listenPort}
|
||||
'';
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
PrivateTmp = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ truh ];
|
||||
}
|
58
pkgs/tools/misc/plantuml-server/default.nix
Normal file
58
pkgs/tools/misc/plantuml-server/default.nix
Normal file
|
@ -0,0 +1,58 @@
|
|||
{ stdenv, fetchFromGitHub, maven, jdk }:
|
||||
|
||||
let
|
||||
version = "1.2020.14";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "plantuml";
|
||||
repo = "plantuml-server";
|
||||
rev = "v${version}";
|
||||
sha256 = "08g6ddpkly5yhjhw7gpsanyspar1752jy9cypwxsqrdzqrv738b8";
|
||||
};
|
||||
|
||||
# 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;
|
||||
buildInputs = [ jdk maven ];
|
||||
buildPhase = ''
|
||||
while mvn package -Dmaven.repo.local=$out/.m2; [ $? = 1 ]; do
|
||||
echo "timeout, restart maven to continue downloading"
|
||||
done
|
||||
'';
|
||||
# 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'';
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "1wwgyjalhlj5azggs9vvsrr54pg7gl8p36pgf6pk12rsszzl7a97";
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "plantuml-server";
|
||||
inherit version;
|
||||
inherit src;
|
||||
|
||||
buildInputs = [ jdk maven ];
|
||||
|
||||
buildPhase = ''
|
||||
# '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
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/webapps"
|
||||
cp "target/plantuml.war" "$out/webapps/plantuml.war"
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A web application to generate UML diagrams on-the-fly.";
|
||||
homepage = "https://plantuml.com/";
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ truh ];
|
||||
};
|
||||
}
|
|
@ -6588,6 +6588,8 @@ in
|
|||
graphviz = graphviz_2_32;
|
||||
};
|
||||
|
||||
plantuml-server = callPackage ../tools/misc/plantuml-server { };
|
||||
|
||||
plan9port = callPackage ../tools/system/plan9port { };
|
||||
|
||||
platformioPackages = dontRecurseIntoAttrs (callPackage ../development/arduino/platformio { });
|
||||
|
|
Loading…
Reference in a new issue