mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 15:35:30 +00:00
Created builder template for making new builders that will work with existing code
This commit is contained in:
parent
1d28982b43
commit
387eb9ba27
5 changed files with 508 additions and 206 deletions
66
modules/plugins/languages/tex/build/builders/custom.nix.bak
Normal file
66
modules/plugins/languages/tex/build/builders/custom.nix.bak
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.types) bool listOf package str;
|
||||
inherit (lib) mkDefault;
|
||||
|
||||
cfg = config.vim.languages.tex;
|
||||
|
||||
# --- Enable Options ---
|
||||
mkEnableDefaultOption = default: description: (mkOption {
|
||||
type = bool;
|
||||
default = default;
|
||||
example = !default;
|
||||
description = description;
|
||||
});
|
||||
|
||||
collateArgs = buildConfig: buildConfig.builders.custom.args;
|
||||
in {
|
||||
options.vim.languages.tex.build.builders.custom = {
|
||||
enable = mkEnableDefaultOption false "Whether to enable using a custom build package";
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.tectonic;
|
||||
description = "build/compiler package";
|
||||
};
|
||||
executable = mkOption {
|
||||
type = str;
|
||||
default = "tectonic";
|
||||
description = "The executable name from the build package that will be used to build/compile the tex.";
|
||||
};
|
||||
args = mkOption {
|
||||
type = listOf str;
|
||||
default = [
|
||||
"-X"
|
||||
"compile"
|
||||
"%f"
|
||||
"--synctex"
|
||||
"--keep-logs"
|
||||
"--keep-intermediates"
|
||||
];
|
||||
description = ''
|
||||
Defines additional arguments that are passed to the configured LaTeX build tool.
|
||||
Note that flags and their arguments need to be separate elements in this array.
|
||||
To pass the arguments -foo bar to a build tool, args needs to be ["-foo" "bar"].
|
||||
The placeholder `%f` will be replaced by the server.
|
||||
|
||||
Placeholders:
|
||||
- `%f`: The path of the TeX file to compile.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable && cfg.build.builders.custom.enable) {
|
||||
vim.languages.tex.build.builder = {
|
||||
name = mkDefault "custom";
|
||||
args = mkDefault (collateArgs cfg.build);
|
||||
package = mkDefault (cfg.build.builders.custom.package);
|
||||
executable = mkDefault (cfg.build.builders.custom.executable);
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue