Switched to using lib.nvim.config.mkBool where appropriate

This commit is contained in:
isaacST08 2025-01-26 16:06:21 -07:00
commit ca9ab42048
3 changed files with 16 additions and 47 deletions

View file

@ -1,6 +1,5 @@
# TODO: I need testing.
{
config,
pkgs,
lib,
...
@ -13,16 +12,6 @@
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) bool package str;
cfg = config.vim.languages.tex;
# --- Enable Options ---
mkEnableDefaultOption = default: description: (mkOption {
type = bool;
default = default;
example = !default;
description = description;
});
in (
template {
inherit name moduleInheritencePackage;

View file

@ -11,18 +11,11 @@
template = import ./builderTemplate.nix;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) bool enum ints listOf package str;
inherit (lib.types) enum ints listOf package str;
inherit (lib.nvim.config) mkBool;
inherit (builtins) concatLists elem map toString;
cfg = config.vim.languages.tex;
# --- Enable Options ---
mkEnableDefaultOption = default: description: (mkOption {
type = bool;
default = default;
example = !default;
description = description;
});
in (
template {
inherit name moduleInheritencePackage;
@ -43,26 +36,30 @@ in (
};
# -- Flags --
keepIntermediates = mkEnableDefaultOption false ''
keepIntermediates = mkBool false ''
Keep the intermediate files generated during processing.
If texlab is reporting build errors when there shouldn't be, disable this option.
'';
keepLogs = mkEnableDefaultOption true ''
keepLogs = mkBool true ''
Keep the log files generated during processing.
Without the keepLogs flag, texlab won't be able to report compilation warnings.
'';
onlyCached = mkEnableDefaultOption false "Use only resource files cached locally";
synctex = mkEnableDefaultOption true "Generate SyncTeX data";
untrustedInput = mkEnableDefaultOption false "Input is untrusted -- disable all known-insecure features";
onlyCached = mkBool false "Use only resource files cached locally";
synctex = mkBool true "Generate SyncTeX data";
untrustedInput = mkBool false "Input is untrusted -- disable all known-insecure features";
# -- Options --
reruns = mkOption {
type = ints.unsigned;
default = 0;
example = 2;
description = "Rerun the TeX engine exactly this many times after the first";
description = ''
Rerun the TeX engine exactly this many times after the first.
Setting this value to 0 will diable setting this option.
'';
};
bundle = mkOption {

View file

@ -19,13 +19,7 @@
}: let
inherit (lib.options) mkOption;
inherit (lib.modules) mkIf;
inherit
(lib.types)
bool
listOf
package
str
;
inherit (lib.types) listOf package str;
inherit
(builtins)
attrNames
@ -39,20 +33,14 @@
throw
toString
;
inherit (lib.nvim.config) mkBool;
cfg = config.vim.languages.tex;
# --- Enable Options ---
mkEnableDefaultOption = default: description: (mkOption {
type = bool;
default = default;
example = !default;
description = description;
});
mkEnableLspOption = mkEnableDefaultOption config.vim.languages.enableLSP;
in {
options.vim.languages.tex.lsp.texlab = {
enable = mkEnableLspOption "Whether to enable Tex LSP support (texlab)";
enable = mkBool config.vim.languages.enableLSP "Whether to enable Tex LSP support (texlab)";
package = mkOption {
type = package;
@ -61,11 +49,7 @@ in {
};
forwardSearch = {
enable = mkOption {
type = bool;
default = false;
example = true;
description = ''
enable = mkBool false ''
Whether to enable forward search.
Enable this option if you want to have the compiled document appear in your chosen PDF viewer.
@ -73,7 +57,6 @@ in {
For some options see [here](https://github.com/latex-lsp/texlab/wiki/Previewing).
Note this is not all the options, but can act as a guide to help you allong with custom configs.
'';
};
package = mkOption {
type = package;
default = pkgs.okular;