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. # TODO: I need testing.
{ {
config,
pkgs, pkgs,
lib, lib,
... ...
@ -13,16 +12,6 @@
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) bool package str; 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 ( in (
template { template {
inherit name moduleInheritencePackage; inherit name moduleInheritencePackage;

View file

@ -11,18 +11,11 @@
template = import ./builderTemplate.nix; template = import ./builderTemplate.nix;
inherit (lib.options) mkOption mkEnableOption; 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; inherit (builtins) concatLists elem map toString;
cfg = config.vim.languages.tex; cfg = config.vim.languages.tex;
# --- Enable Options ---
mkEnableDefaultOption = default: description: (mkOption {
type = bool;
default = default;
example = !default;
description = description;
});
in ( in (
template { template {
inherit name moduleInheritencePackage; inherit name moduleInheritencePackage;
@ -43,26 +36,30 @@ in (
}; };
# -- Flags -- # -- Flags --
keepIntermediates = mkEnableDefaultOption false '' keepIntermediates = mkBool false ''
Keep the intermediate files generated during processing. 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 = mkEnableDefaultOption true '' keepLogs = mkBool true ''
Keep the log files generated during processing. 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 = mkEnableDefaultOption false "Use only resource files cached locally"; onlyCached = mkBool false "Use only resource files cached locally";
synctex = mkEnableDefaultOption true "Generate SyncTeX data"; synctex = mkBool true "Generate SyncTeX data";
untrustedInput = mkEnableDefaultOption false "Input is untrusted -- disable all known-insecure features"; untrustedInput = mkBool false "Input is untrusted -- disable all known-insecure features";
# -- Options -- # -- Options --
reruns = mkOption { reruns = mkOption {
type = ints.unsigned; type = ints.unsigned;
default = 0; default = 0;
example = 2; 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 { bundle = mkOption {

View file

@ -19,13 +19,7 @@
}: let }: let
inherit (lib.options) mkOption; inherit (lib.options) mkOption;
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit inherit (lib.types) listOf package str;
(lib.types)
bool
listOf
package
str
;
inherit inherit
(builtins) (builtins)
attrNames attrNames
@ -39,20 +33,14 @@
throw throw
toString toString
; ;
inherit (lib.nvim.config) mkBool;
cfg = config.vim.languages.tex; cfg = config.vim.languages.tex;
# --- Enable Options --- # --- Enable Options ---
mkEnableDefaultOption = default: description: (mkOption {
type = bool;
default = default;
example = !default;
description = description;
});
mkEnableLspOption = mkEnableDefaultOption config.vim.languages.enableLSP;
in { in {
options.vim.languages.tex.lsp.texlab = { 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 { package = mkOption {
type = package; type = package;
@ -61,11 +49,7 @@ in {
}; };
forwardSearch = { forwardSearch = {
enable = mkOption { enable = mkBool false ''
type = bool;
default = false;
example = true;
description = ''
Whether to enable forward search. Whether to enable forward search.
Enable this option if you want to have the compiled document appear in your chosen PDF viewer. 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). 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. Note this is not all the options, but can act as a guide to help you allong with custom configs.
''; '';
};
package = mkOption { package = mkOption {
type = package; type = package;
default = pkgs.okular; default = pkgs.okular;