Utilized lib.optionalAttrs to simplify code

This commit is contained in:
isaacST08 2025-02-11 21:28:17 -07:00
commit c440ba5826

View file

@ -5,6 +5,7 @@
... ...
}: let }: let
inherit (builtins) isString map; inherit (builtins) isString map;
inherit (lib) optionalAttrs;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.config) mkBool; inherit (lib.nvim.config) mkBool;
inherit (lib.options) mkOption mkPackageOption; inherit (lib.options) mkOption mkPackageOption;
@ -529,9 +530,7 @@ in {
} }
# #
# -- Build -- # -- Build --
// ( // (optionalAttrs cfg.build.enable {
if cfg.build.enable
then {
build = { build = {
inherit inherit
(cfg.build) (cfg.build)
@ -546,37 +545,25 @@ in {
inherit (builderCfg) args; inherit (builderCfg) args;
executable = "${builderCfg.package}/bin/${builderCfg.executable}"; executable = "${builderCfg.package}/bin/${builderCfg.executable}";
}; };
} })
else {}
)
# #
# -- Chktex -- # -- Chktex --
// ( // (optionalAttrs texlabCfg.chktex.enable {
if texlabCfg.chktex.enable
then {
chktex = { chktex = {
inherit (texlabCfg.chktex) onOpenAndSave onEdit additionalArgs; inherit (texlabCfg.chktex) onOpenAndSave onEdit additionalArgs;
}; };
} })
else {}
)
# #
# -- Forward Search -- # -- Forward Search --
// ( // (optionalAttrs texlabCfg.forwardSearch.enable {
if texlabCfg.forwardSearch.enable
then {
forwardSearch = { forwardSearch = {
inherit (texlabCfg.forwardSearch) args; inherit (texlabCfg.forwardSearch) args;
executable = "${texlabCfg.forwardSearch.package}/bin/${texlabCfg.forwardSearch.executable}"; executable = "${texlabCfg.forwardSearch.package}/bin/${texlabCfg.forwardSearch.executable}";
}; };
} })
else {}
)
# #
# -- Symbols -- # -- Symbols --
// ( // (optionalAttrs texlabCfg.symbols.enable {
if texlabCfg.symbols.enable
then {
symbols = { symbols = {
inherit (texlabCfg.symbols) allowedPatterns ignoredPatterns; inherit (texlabCfg.symbols) allowedPatterns ignoredPatterns;
@ -590,9 +577,7 @@ in {
}) })
texlabCfg.symbols.customEnvironments; texlabCfg.symbols.customEnvironments;
}; };
} })
else {}
)
# #
# -- Extra Settings -- # -- Extra Settings --
// texlabCfg.extraLuaSettings // texlabCfg.extraLuaSettings