Cleaned up documentation and other performed other code cleanups

This commit is contained in:
isaacST08 2025-02-11 21:14:24 -07:00
commit c3c720f4a2
13 changed files with 343 additions and 213 deletions

View file

@ -12,7 +12,7 @@
inherit (lib) optionals;
inherit (lib.options) mkOption mkEnableOption mkPackageOption;
inherit (lib.types) enum ints listOf str;
inherit (lib.types) enum ints listOf str nullOr;
inherit (lib.nvim.config) mkBool;
inherit (builtins) concatLists elem map toString;
@ -29,23 +29,32 @@ in (
executable = mkOption {
type = str;
default = "tectonic";
description = "The executable name from the build package that will be used to build/compile the tex.";
description = ''
The executable name from the build package that will be used to
build/compile the tex.
'';
};
# -- Flags --
keepIntermediates = mkBool false ''
Whether to keep the intermediate files generated during processing.
If texlab is reporting build errors when there shouldn't be, disable this option.
If texlab is reporting build errors when there shouldn't be, disable
this option.
'';
keepLogs = mkBool true ''
Whether to keep the log files generated during processing.
Without the keepLogs flag, texlab won't be able to report compilation warnings.
Without the keepLogs flag, texlab won't be able to report compilation
warnings.
'';
onlyCached = mkBool false ''
Whether to use only resource files cached locally
'';
onlyCached = mkBool false "Whether to use only resource files cached locally";
synctex = mkBool true "Whether to generate SyncTeX data";
untrustedInput = mkBool false "Whether to input is untrusted -- disable all known-insecure features";
untrustedInput = mkBool false ''
Whether to diable all known-insecure features if the input is untrusted
'';
# -- Options --
reruns = mkOption {
@ -62,28 +71,37 @@ in (
};
bundle = mkOption {
type = str;
default = "";
description = "Use this directory or Zip-format bundle file to find resource files instead of the default";
type = nullOr str;
default = null;
description = ''
Use this directory or Zip-format bundle file to find resource files
instead of the default.
'';
};
webBundle = mkOption {
type = str;
default = "";
description = "Use this URL to find resource files instead of the default";
type = nullOr str;
default = null;
description = ''
Use this URL to find resource files instead of the default.
'';
};
outfmt = mkOption {
type = enum [
type = nullOr (enum [
"pdf"
"html"
"xdv"
"aux"
"fmt"
""
];
default = "";
description = "The kind of output to generate";
]);
default = null;
description = ''
The kind of output to generate.
Setting this to `null` (default) will let tectonic decide the most
appropriate output format, which usually be a pdf.
'';
};
hidePaths = mkOption {
@ -93,23 +111,27 @@ in (
"./secrets.tex"
"./passwords.tex"
];
description = "Tell the engine that no file at <hide_path> exists, if it tries to read it.";
description = ''
Tell the engine that no file at `<path/to/hide>` exists, if it tries
to read it.
'';
};
format = mkOption {
type = str;
default = "";
description = "The name of the \"format\" file used to initialize the TeX engine";
type = nullOr str;
default = null;
description = ''
The name of the \"format\" file used to initialize the TeX engine.
'';
};
color = mkOption {
type = enum [
type = nullOr (enum [
"always"
"auto"
"never"
""
];
default = "";
]);
default = null;
example = "always";
description = "Enable/disable colorful log output";
};
@ -118,8 +140,10 @@ in (
type = listOf str;
default = [];
description = ''
Add extra command line options to include in the tectonic build command.
Extra options added here will not overwrite the options set in as nvf options.
Add extra command line options to include in the tectonic build
command.
Extra options added here will not overwrite the options set in as nvf
options.
'';
};
};
@ -139,12 +163,12 @@ in (
++ (optionals builderCfg.untrustedInput ["--untrusted"])
# Options
++ (optionals (builderCfg.reruns > 0) ["--reruns" "${toString builderCfg.reruns}"])
++ (optionals (builderCfg.bundle != "") ["--bundle" "${toString builderCfg.bundle}"])
++ (optionals (builderCfg.webBundle != "") ["--web-bundle" "${toString builderCfg.webBundle}"])
++ (optionals (builderCfg.outfmt != "") ["--outfmt" "${toString builderCfg.outfmt}"])
++ (optionals (builderCfg.bundle != null) ["--bundle" "${toString builderCfg.bundle}"])
++ (optionals (builderCfg.webBundle != null) ["--web-bundle" "${toString builderCfg.webBundle}"])
++ (optionals (builderCfg.outfmt != null) ["--outfmt" "${toString builderCfg.outfmt}"])
++ (concatLists (map (x: ["--hide" x]) builderCfg.hidePaths))
++ (optionals (builderCfg.format != "") ["--format" "${toString builderCfg.format}"])
++ (optionals (builderCfg.color != "") ["--color" "${toString builderCfg.color}"])
++ (optionals (builderCfg.format != null) ["--format" "${toString builderCfg.format}"])
++ (optionals (builderCfg.color != null) ["--color" "${toString builderCfg.color}"])
# Still options but these are not defined by builder specific options but
# instead synchronize options between the global build options and builder
# specific options