mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-16 02:33:25 +00:00
2e751c0772
the conversion procedure is simple: - find all things that look like options, ie calls to either `mkOption` or `lib.mkOption` that take an attrset. remember the attrset as the option - for all options, find a `description` attribute who's value is not a call to `mdDoc` or `lib.mdDoc` - textually convert the entire value of the attribute to MD with a few simple regexes (the set from mdize-module.sh) - if the change produced a change in the manual output, discard - if the change kept the manual unchanged, add some text to the description to make sure we've actually found an option. if the manual changes this time, keep the converted description this procedure converts 80% of nixos options to markdown. around 2000 options remain to be inspected, but most of those fail the "does not change the manual output check": currently the MD conversion process does not faithfully convert docbook tags like <code> and <package>, so any option using such tags will not be converted at all.
141 lines
4.0 KiB
Nix
141 lines
4.0 KiB
Nix
{ 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;
|
|
defaultText = literalExpression "pkgs.plantuml-server";
|
|
description = lib.mdDoc "PlantUML server package to use";
|
|
};
|
|
|
|
packages = {
|
|
jdk = mkOption {
|
|
type = types.package;
|
|
default = pkgs.jdk;
|
|
defaultText = literalExpression "pkgs.jdk";
|
|
description = lib.mdDoc "JDK package to use for the server";
|
|
};
|
|
jetty = mkOption {
|
|
type = types.package;
|
|
default = pkgs.jetty;
|
|
defaultText = literalExpression "pkgs.jetty";
|
|
description = lib.mdDoc "Jetty package to use for the server";
|
|
};
|
|
};
|
|
|
|
user = mkOption {
|
|
type = types.str;
|
|
default = "plantuml";
|
|
description = lib.mdDoc "User which runs PlantUML server.";
|
|
};
|
|
|
|
group = mkOption {
|
|
type = types.str;
|
|
default = "plantuml";
|
|
description = lib.mdDoc "Group which runs PlantUML server.";
|
|
};
|
|
|
|
home = mkOption {
|
|
type = types.str;
|
|
default = "/var/lib/plantuml";
|
|
description = lib.mdDoc "Home directory of the PlantUML server instance.";
|
|
};
|
|
|
|
listenHost = mkOption {
|
|
type = types.str;
|
|
default = "127.0.0.1";
|
|
description = lib.mdDoc "Host to listen on.";
|
|
};
|
|
|
|
listenPort = mkOption {
|
|
type = types.int;
|
|
default = 8080;
|
|
description = lib.mdDoc "Port to listen on.";
|
|
};
|
|
|
|
plantumlLimitSize = mkOption {
|
|
type = types.int;
|
|
default = 4096;
|
|
description = lib.mdDoc "Limits image width and height.";
|
|
};
|
|
|
|
graphvizPackage = mkOption {
|
|
type = types.package;
|
|
default = pkgs.graphviz;
|
|
defaultText = literalExpression "pkgs.graphviz";
|
|
description = lib.mdDoc "Package containing the dot executable.";
|
|
};
|
|
|
|
plantumlStats = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = lib.mdDoc "Set it to on to enable statistics report (https://plantuml.com/statistics-report).";
|
|
};
|
|
|
|
httpAuthorization = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = lib.mdDoc "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 = lib.mdDoc "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 = ''
|
|
${cfg.packages.jdk}/bin/java \
|
|
-jar ${cfg.packages.jetty}/start.jar \
|
|
--module=deploy,http,jsp \
|
|
jetty.home=${cfg.packages.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 ];
|
|
}
|