1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-25 18:46:32 +03:00

nixos/plantuml-server: remove with lib; notation

https://nix.dev/guides/best-practices#with-scopes
This commit is contained in:
Anthony Roussel 2023-11-14 23:56:17 +01:00
parent 4d77d2a63f
commit e3839eef71
No known key found for this signature in database
GPG key ID: 9DC4987B1A55E75E

View file

@ -1,8 +1,15 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
inherit (lib)
literalExpression
mdDoc
mkEnableOption
mkIf
mkOption
mkPackageOptionMD
types
;
cfg = config.services.plantuml-server; cfg = config.services.plantuml-server;
@ -11,13 +18,13 @@ in
{ {
options = { options = {
services.plantuml-server = { services.plantuml-server = {
enable = mkEnableOption (lib.mdDoc "PlantUML server"); enable = mkEnableOption (mdDoc "PlantUML server");
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.plantuml-server; default = pkgs.plantuml-server;
defaultText = literalExpression "pkgs.plantuml-server"; defaultText = literalExpression "pkgs.plantuml-server";
description = lib.mdDoc "PlantUML server package to use"; description = mdDoc "PlantUML server package to use";
}; };
packages = { packages = {
@ -25,75 +32,75 @@ in
type = types.package; type = types.package;
default = pkgs.jdk; default = pkgs.jdk;
defaultText = literalExpression "pkgs.jdk"; defaultText = literalExpression "pkgs.jdk";
description = lib.mdDoc "JDK package to use for the server"; description = mdDoc "JDK package to use for the server";
}; };
jetty = mkOption { jetty = mkOption {
type = types.package; type = types.package;
default = pkgs.jetty; default = pkgs.jetty;
defaultText = literalExpression "pkgs.jetty"; defaultText = literalExpression "pkgs.jetty";
description = lib.mdDoc "Jetty package to use for the server"; description = mdDoc "Jetty package to use for the server";
}; };
}; };
user = mkOption { user = mkOption {
type = types.str; type = types.str;
default = "plantuml"; default = "plantuml";
description = lib.mdDoc "User which runs PlantUML server."; description = mdDoc "User which runs PlantUML server.";
}; };
group = mkOption { group = mkOption {
type = types.str; type = types.str;
default = "plantuml"; default = "plantuml";
description = lib.mdDoc "Group which runs PlantUML server."; description = mdDoc "Group which runs PlantUML server.";
}; };
home = mkOption { home = mkOption {
type = types.str; type = types.str;
default = "/var/lib/plantuml"; default = "/var/lib/plantuml";
description = lib.mdDoc "Home directory of the PlantUML server instance."; description = mdDoc "Home directory of the PlantUML server instance.";
}; };
listenHost = mkOption { listenHost = mkOption {
type = types.str; type = types.str;
default = "127.0.0.1"; default = "127.0.0.1";
description = lib.mdDoc "Host to listen on."; description = mdDoc "Host to listen on.";
}; };
listenPort = mkOption { listenPort = mkOption {
type = types.int; type = types.int;
default = 8080; default = 8080;
description = lib.mdDoc "Port to listen on."; description = mdDoc "Port to listen on.";
}; };
plantumlLimitSize = mkOption { plantumlLimitSize = mkOption {
type = types.int; type = types.int;
default = 4096; default = 4096;
description = lib.mdDoc "Limits image width and height."; description = mdDoc "Limits image width and height.";
}; };
graphvizPackage = mkOption { graphvizPackage = mkOption {
type = types.package; type = types.package;
default = pkgs.graphviz; default = pkgs.graphviz;
defaultText = literalExpression "pkgs.graphviz"; defaultText = literalExpression "pkgs.graphviz";
description = lib.mdDoc "Package containing the dot executable."; description = mdDoc "Package containing the dot executable.";
}; };
plantumlStats = mkOption { plantumlStats = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = lib.mdDoc "Set it to on to enable statistics report (https://plantuml.com/statistics-report)."; description = mdDoc "Set it to on to enable statistics report (https://plantuml.com/statistics-report).";
}; };
httpAuthorization = mkOption { httpAuthorization = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = lib.mdDoc "When calling the proxy endpoint, the value of HTTP_AUTHORIZATION will be used to set the HTTP Authorization header."; description = mdDoc "When calling the proxy endpoint, the value of HTTP_AUTHORIZATION will be used to set the HTTP Authorization header.";
}; };
allowPlantumlInclude = mkOption { allowPlantumlInclude = mkOption {
type = types.bool; type = types.bool;
default = false; 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."; description = mdDoc "Enables !include processing which can read files from the server into diagrams. Files are read relative to the current working directory.";
}; };
}; };
}; };