neovim: mark plugins as optional (possibly) (#1559)
can be loaded with packadd!
This commit is contained in:
parent
e6a58a7e71
commit
9d775bad07
|
@ -24,15 +24,20 @@ let
|
||||||
|
|
||||||
pluginWithConfigType = types.submodule {
|
pluginWithConfigType = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
plugin = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
description = "vim plugin";
|
|
||||||
};
|
|
||||||
config = mkOption {
|
config = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
description = "vimscript for this plugin to be placed in init.vim";
|
description = "vimscript for this plugin to be placed in init.vim";
|
||||||
default = "";
|
default = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
optional = mkEnableOption "optional" // {
|
||||||
|
description = "Don't load by default (load with :packadd)";
|
||||||
|
};
|
||||||
|
|
||||||
|
plugin = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
description = "vim plugin";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,8 +54,15 @@ let
|
||||||
|| (lib.filter (hasAttr "config") cfg.plugins) != [ ]) {
|
|| (lib.filter (hasAttr "config") cfg.plugins) != [ ]) {
|
||||||
customRC = cfg.extraConfig
|
customRC = cfg.extraConfig
|
||||||
+ pkgs.lib.concatMapStrings pluginConfig cfg.plugins;
|
+ pkgs.lib.concatMapStrings pluginConfig cfg.plugins;
|
||||||
} // optionalAttrs (cfg.plugins != [ ]) {
|
|
||||||
packages.home-manager.start = map (x: x.plugin or x) cfg.plugins;
|
packages.home-manager = {
|
||||||
|
start = filter (f: f != null) (map (x:
|
||||||
|
if x ? plugin && x.optional == true then null else (x.plugin or x))
|
||||||
|
cfg.plugins);
|
||||||
|
opt = filter (f: f != null)
|
||||||
|
(map (x: if x ? plugin && x.optional == true then x.plugin else null)
|
||||||
|
cfg.plugins);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [ ])
|
extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [ ])
|
||||||
''--prefix PATH : "${lib.makeBinPath cfg.extraPackages}"'';
|
''--prefix PATH : "${lib.makeBinPath cfg.extraPackages}"'';
|
||||||
|
|
Loading…
Reference in a new issue