mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-24 17:58:38 +02:00
modules: refactor plugins code in top-level
This commit is contained in:
parent
d81f37256d
commit
efb24d78bd
7 changed files with 221 additions and 122 deletions
53
modules/top-level/plugins/default.nix
Normal file
53
modules/top-level/plugins/default.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (import ./utils.nix lib)
|
||||
normalizedPluginType
|
||||
normalizePlugins
|
||||
;
|
||||
byteCompileCfg = config.performance.byteCompileLua;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
build.plugins = lib.mkOption {
|
||||
visible = false;
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
type = lib.types.listOf normalizedPluginType;
|
||||
description = ''
|
||||
Final list of (normalized) plugins that will be passed to the wrapper.
|
||||
|
||||
It notably implements:
|
||||
- byte-compilation (performance.byteCompileLua) -> ./byte-compile-plugins.nix
|
||||
- plugins combining (performance.combinePlugins) -> ./combine-plugins.nix
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
build.plugins =
|
||||
let
|
||||
shouldCompilePlugins = byteCompileCfg.enable && byteCompileCfg.plugins;
|
||||
byteCompilePlugins = import ./byte-compile-plugins.nix { inherit lib pkgs; };
|
||||
|
||||
shouldCombinePlugins = config.performance.combinePlugins.enable;
|
||||
combinePlugins = import ./combine-plugins.nix {
|
||||
inherit lib pkgs;
|
||||
inherit (config.performance.combinePlugins)
|
||||
standalonePlugins
|
||||
pathsToLink
|
||||
;
|
||||
};
|
||||
in
|
||||
|
||||
lib.pipe config.extraPlugins (
|
||||
[ normalizePlugins ]
|
||||
++ lib.optionals shouldCompilePlugins [ byteCompilePlugins ]
|
||||
++ lib.optionals shouldCombinePlugins [ combinePlugins ]
|
||||
);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue