mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 15:35:30 +00:00
Added usage of lib.optionals and created an assersion to check the number of enabled builders
This commit is contained in:
parent
d6000a4f78
commit
d638292e77
3 changed files with 29 additions and 71 deletions
|
|
@ -4,6 +4,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.types) str nullOr;
|
||||
inherit (builtins) filter isAttrs hasAttr attrNames length elemAt;
|
||||
inherit (lib.nvim.config) mkBool;
|
||||
|
|
@ -48,11 +49,7 @@ in {
|
|||
|
||||
options.vim.languages.tex.build = {
|
||||
enable =
|
||||
mkBool (
|
||||
if enabledBuildersCount > 1
|
||||
then throw "nvf-tex-language does not support having more than 1 builders enabled!"
|
||||
else (enabledBuildersCount == 1)
|
||||
) ''
|
||||
mkBool (enabledBuildersCount == 1) ''
|
||||
Whether to enable configuring the builder.
|
||||
|
||||
By enabling any of the builders, this option will be automatically set.
|
||||
|
|
@ -106,8 +103,19 @@ in {
|
|||
type = nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Allows overriding the default file name of the build artifact. This setting is used to find the correct PDF file to open during forward search.
|
||||
Allows overriding the default file name of the build artifact.
|
||||
This setting is used to find the correct PDF file to open during forward search.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
config = mkIf (enabledBuildersCount > 0) {
|
||||
assertions = [
|
||||
{
|
||||
assertion = (enabledBuildersCount < 2);
|
||||
message = "The nvf-tex-language implementation does not support having more than 1 builders enabled.";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue