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