mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
lib/plugins: infer packPathName
Signed-off-by: saygo-png <saygo.mail@proton.me>
This commit is contained in:
parent
c4b27080a6
commit
4cec67651a
3 changed files with 12 additions and 13 deletions
|
|
@ -20,7 +20,6 @@
|
|||
# For example, they might just be configured through some other mean, like global variables
|
||||
hasLuaConfig ? true,
|
||||
# options
|
||||
packPathName ? name,
|
||||
# Can be a string, a list of strings, or a module option:
|
||||
# - A string will be intrpreted as `pkgs.vimPlugins.${package}`
|
||||
# - A list will be interpreted as a "pkgs path", e.g. `pkgs.${elem1}.${elem2}.${etc...}`
|
||||
|
|
@ -66,9 +65,9 @@ let
|
|||
{
|
||||
options = lib.setAttrByPath loc (
|
||||
{
|
||||
enable = lib.mkEnableOption packPathName;
|
||||
autoLoad = lib.nixvim.mkAutoLoadOption cfg packPathName;
|
||||
lazyLoad = lib.nixvim.mkLazyLoadOption packPathName;
|
||||
enable = lib.mkEnableOption name;
|
||||
autoLoad = lib.nixvim.mkAutoLoadOption cfg name;
|
||||
lazyLoad = lib.nixvim.mkLazyLoadOption name;
|
||||
}
|
||||
// lib.optionalAttrs hasSettings {
|
||||
settings = lib.nixvim.mkSettingsOption {
|
||||
|
|
@ -114,7 +113,7 @@ let
|
|||
assertions = [
|
||||
{
|
||||
assertion = (isColorscheme && colorscheme != null) || cfg.lazyLoad.settings != { };
|
||||
message = "You have enabled lazy loading for ${packPathName} but have not provided any configuration.";
|
||||
message = "You have enabled lazy loading for ${name} but have not provided any configuration.";
|
||||
}
|
||||
];
|
||||
|
||||
|
|
@ -122,7 +121,8 @@ let
|
|||
plugins = [
|
||||
(
|
||||
{
|
||||
__unkeyed-1 = packPathName;
|
||||
# The packpath name is always the derivation name
|
||||
__unkeyed-1 = lib.getName cfg.package;
|
||||
# Use provided after, otherwise fallback to normal function wrapped lua content
|
||||
after =
|
||||
let
|
||||
|
|
@ -162,7 +162,7 @@ in
|
|||
imports
|
||||
++ [
|
||||
module
|
||||
(utils.mkPluginPackageModule { inherit loc packPathName package; })
|
||||
(utils.mkPluginPackageModule { inherit loc name package; })
|
||||
(utils.mkMetaModule {
|
||||
inherit
|
||||
loc
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
isColorscheme ? false,
|
||||
colorscheme ? name,
|
||||
# options
|
||||
packPathName ? name,
|
||||
# Can be a string, a list of strings, or a module option:
|
||||
# - A string will be intrpreted as `pkgs.vimPlugins.${package}`
|
||||
# - A list will be interpreted as a "pkgs path", e.g. `pkgs.${elem1}.${elem2}.${etc...}`
|
||||
|
|
@ -59,8 +58,8 @@ let
|
|||
{
|
||||
options = lib.setAttrByPath loc (
|
||||
{
|
||||
enable = lib.mkEnableOption packPathName;
|
||||
autoLoad = lib.nixvim.mkAutoLoadOption cfg packPathName;
|
||||
enable = lib.mkEnableOption name;
|
||||
autoLoad = lib.nixvim.mkAutoLoadOption cfg name;
|
||||
}
|
||||
// settingsOption
|
||||
// extraOptions
|
||||
|
|
@ -93,7 +92,7 @@ in
|
|||
imports
|
||||
++ [
|
||||
module
|
||||
(lib.nixvim.plugins.utils.mkPluginPackageModule { inherit loc packPathName package; })
|
||||
(lib.nixvim.plugins.utils.mkPluginPackageModule { inherit loc name package; })
|
||||
(lib.nixvim.plugins.utils.mkMetaModule {
|
||||
inherit
|
||||
loc
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
mkPluginPackageModule =
|
||||
{
|
||||
loc,
|
||||
packPathName,
|
||||
name,
|
||||
package,
|
||||
}:
|
||||
# Return a module
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
if lib.isOption package then
|
||||
package
|
||||
else
|
||||
lib.mkPackageOption pkgs packPathName {
|
||||
lib.mkPackageOption pkgs name {
|
||||
default =
|
||||
if builtins.isList package then
|
||||
package
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue