From ca9ab4204847412d6a472bbfd90f70b75da98763 Mon Sep 17 00:00:00 2001 From: isaacST08 Date: Sun, 26 Jan 2025 16:06:21 -0700 Subject: [PATCH] Switched to using lib.nvim.config.mkBool where appropriate --- .../languages/tex/build/builders/latexmk.nix | 11 -------- .../languages/tex/build/builders/tectonic.nix | 27 +++++++++---------- modules/plugins/languages/tex/lsp/texlab.nix | 25 +++-------------- 3 files changed, 16 insertions(+), 47 deletions(-) diff --git a/modules/plugins/languages/tex/build/builders/latexmk.nix b/modules/plugins/languages/tex/build/builders/latexmk.nix index 1cc4eb51..edc46584 100644 --- a/modules/plugins/languages/tex/build/builders/latexmk.nix +++ b/modules/plugins/languages/tex/build/builders/latexmk.nix @@ -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; diff --git a/modules/plugins/languages/tex/build/builders/tectonic.nix b/modules/plugins/languages/tex/build/builders/tectonic.nix index 71facf1e..ec6e253c 100644 --- a/modules/plugins/languages/tex/build/builders/tectonic.nix +++ b/modules/plugins/languages/tex/build/builders/tectonic.nix @@ -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 { diff --git a/modules/plugins/languages/tex/lsp/texlab.nix b/modules/plugins/languages/tex/lsp/texlab.nix index fd319a6d..e5dea908 100644 --- a/modules/plugins/languages/tex/lsp/texlab.nix +++ b/modules/plugins/languages/tex/lsp/texlab.nix @@ -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;