12 # The C4-PlantUML docs say that it suffices to run plantuml with the
13 # -DRELATIVE_INCLUDE="..." arg to make plantuml find the C4 templates
14 # when included like "!include C4_Container.puml".
15 # Unfortunately, this is not sufficient in practise, when the path is not ".".
16 # What helps is setting -Dplantuml.include.path="..." *before* the jar
18 # The -DRELATIVE_INCLUDE param then *still* needs to be set (*after* the jar
19 # argument), because the C4 template vars check for existence of this variable
20 # and if it is not set, reference paths in the internet.
24 url = "https://github.com/plantuml-stdlib/C4-PlantUML/archive/refs/tags/v2.10.0.zip";
25 hash = "sha256-p9Njb7VauXVf6yOBDQrO9mS+za9NntFUCK5tig0mH3U=";
29 url = "https://github.com/tupadr3/plantuml-icon-font-sprites/archive/refs/tags/v3.0.0.zip";
30 hash = "sha256-I/cR1VPR7aKyTZF9X/4GkgcxV9+sLgNpTZugvCy0Dvs=";
33 # In order to pre-fix the plantuml.jar parameter with the argument
34 # -Dplantuml.include.path=..., we post-fix the java command using a wrapper.
35 # This way the plantuml derivation can remain unchanged.
36 plantumlWithExtraPath =
38 plantumlIncludePath = lib.concatStringsSep ":" [
42 includeFlag = "-Dplantuml.include.path=${lib.escapeShellArg plantumlIncludePath}";
43 postFixedJre = runCommand "jre-postfixed" { nativeBuildInputs = [ makeWrapper ]; } ''
46 makeWrapper ${jre}/bin/java $out/bin/java \
47 --add-flags ${lib.escapeShellArg includeFlag}
50 plantuml.override { jre = postFixedJre; };
54 pname = "plantuml-c4";
57 nativeBuildInputs = [ makeWrapper ];
62 makeWrapper ${plantumlWithExtraPath}/bin/plantuml $out/bin/plantuml \
63 --add-flags "-DRELATIVE_INCLUDE=\"${c4-lib}\""
65 $out/bin/plantuml -help
68 passthru.tests.example-c4-diagram =
69 runCommand "c4-plantuml-sample.png" { nativeBuildInputs = [ plantuml-c4 ]; }
71 sed 's/https:.*\///' "${c4-lib}/samples/C4_Context Diagram Sample - enterprise.puml" > sample.puml
72 plantuml sample.puml -o $out
74 sed 's/!include ..\//!include /' ${sprites}/examples/complex-example.puml > sprites.puml
75 plantuml sprites.puml -o $out
79 description = "PlantUML bundled with C4-Plantuml and plantuml sprites library";
80 mainProgram = "plantuml";
81 homepage = "https://github.com/plantuml-stdlib/C4-PlantUML";
82 license = licenses.mit;
83 maintainers = with maintainers; [
87 platforms = platforms.unix;