mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-10 07:25:30 +00:00
Utilized lib.optionalAttrs to simplify code
This commit is contained in:
parent
c3c720f4a2
commit
c440ba5826
1 changed files with 42 additions and 57 deletions
|
|
@ -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,70 +530,54 @@ in {
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# -- Build --
|
# -- Build --
|
||||||
// (
|
// (optionalAttrs cfg.build.enable {
|
||||||
if cfg.build.enable
|
build = {
|
||||||
then {
|
inherit
|
||||||
build = {
|
(cfg.build)
|
||||||
inherit
|
onSave
|
||||||
(cfg.build)
|
useFileList
|
||||||
onSave
|
auxDirectory
|
||||||
useFileList
|
logDirectory
|
||||||
auxDirectory
|
pdfDirectory
|
||||||
logDirectory
|
filename
|
||||||
pdfDirectory
|
forwardSearchAfter
|
||||||
filename
|
;
|
||||||
forwardSearchAfter
|
inherit (builderCfg) args;
|
||||||
;
|
executable = "${builderCfg.package}/bin/${builderCfg.executable}";
|
||||||
inherit (builderCfg) args;
|
};
|
||||||
executable = "${builderCfg.package}/bin/${builderCfg.executable}";
|
})
|
||||||
};
|
|
||||||
}
|
|
||||||
else {}
|
|
||||||
)
|
|
||||||
#
|
#
|
||||||
# -- Chktex --
|
# -- Chktex --
|
||||||
// (
|
// (optionalAttrs texlabCfg.chktex.enable {
|
||||||
if texlabCfg.chktex.enable
|
chktex = {
|
||||||
then {
|
inherit (texlabCfg.chktex) onOpenAndSave onEdit additionalArgs;
|
||||||
chktex = {
|
};
|
||||||
inherit (texlabCfg.chktex) onOpenAndSave onEdit additionalArgs;
|
})
|
||||||
};
|
|
||||||
}
|
|
||||||
else {}
|
|
||||||
)
|
|
||||||
#
|
#
|
||||||
# -- Forward Search --
|
# -- Forward Search --
|
||||||
// (
|
// (optionalAttrs texlabCfg.forwardSearch.enable {
|
||||||
if texlabCfg.forwardSearch.enable
|
forwardSearch = {
|
||||||
then {
|
inherit (texlabCfg.forwardSearch) args;
|
||||||
forwardSearch = {
|
executable = "${texlabCfg.forwardSearch.package}/bin/${texlabCfg.forwardSearch.executable}";
|
||||||
inherit (texlabCfg.forwardSearch) args;
|
};
|
||||||
executable = "${texlabCfg.forwardSearch.package}/bin/${texlabCfg.forwardSearch.executable}";
|
})
|
||||||
};
|
|
||||||
}
|
|
||||||
else {}
|
|
||||||
)
|
|
||||||
#
|
#
|
||||||
# -- Symbols --
|
# -- Symbols --
|
||||||
// (
|
// (optionalAttrs texlabCfg.symbols.enable {
|
||||||
if texlabCfg.symbols.enable
|
symbols = {
|
||||||
then {
|
inherit (texlabCfg.symbols) allowedPatterns ignoredPatterns;
|
||||||
symbols = {
|
|
||||||
inherit (texlabCfg.symbols) allowedPatterns ignoredPatterns;
|
|
||||||
|
|
||||||
customEnvironments =
|
customEnvironments =
|
||||||
map (x: {
|
map (x: {
|
||||||
inherit (x) name label;
|
inherit (x) name label;
|
||||||
displayName =
|
displayName =
|
||||||
if isString x.displayName
|
if isString x.displayName
|
||||||
then x.displayName
|
then x.displayName
|
||||||
else x.name;
|
else x.name;
|
||||||
})
|
})
|
||||||
texlabCfg.symbols.customEnvironments;
|
texlabCfg.symbols.customEnvironments;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
else {}
|
|
||||||
)
|
|
||||||
#
|
#
|
||||||
# -- Extra Settings --
|
# -- Extra Settings --
|
||||||
// texlabCfg.extraLuaSettings
|
// texlabCfg.extraLuaSettings
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue