feat: can declare extra lua packages
parent
b5a3526f8a
commit
a4cc5d9b9c
24
README.md
24
README.md
|
|
@ -189,6 +189,7 @@ Here's a list of all accepted arguments
|
||||||
| `runtime` | `{}` | Your Runtime configuration (see below) |
|
| `runtime` | `{}` | Your Runtime configuration (see below) |
|
||||||
| `dependencies` | `[]` | A list of your dependencies (see below) |
|
| `dependencies` | `[]` | A list of your dependencies (see below) |
|
||||||
| `dependenciesExtraArgs` | `{}` | Extra arguments to load your dependencies in other files |
|
| `dependenciesExtraArgs` | `{}` | Extra arguments to load your dependencies in other files |
|
||||||
|
| `extraLuaPackages` | `null` | Extra lua packages needed for the plugin |
|
||||||
| `viAlias` | `false` | Wether to create a `vi` alias to run neovim |
|
| `viAlias` | `false` | Wether to create a `vi` alias to run neovim |
|
||||||
| `vimAlias` | `false` | Wether to create a `vim` alias to run neovim |
|
| `vimAlias` | `false` | Wether to create a `vim` alias to run neovim |
|
||||||
| `vimdiffAlias` | `false` | Wether to create a `vimdiff` alias to run neovim in diff mode |
|
| `vimdiffAlias` | `false` | Wether to create a `vimdiff` alias to run neovim in diff mode |
|
||||||
|
|
@ -218,17 +219,18 @@ The dependencies is a list of element of either:
|
||||||
|
|
||||||
The Plugin configuration object accepts the following properties:
|
The Plugin configuration object accepts the following properties:
|
||||||
|
|
||||||
| name | default | description |
|
| name | default | description |
|
||||||
|----------------|---------|----------------------------------------------------------------|
|
|--------------------|---------|----------------------------------------------------------------|
|
||||||
| `plugin` | N/A | The plugin to load² **REQUIRED** |
|
| `plugin` | N/A | The plugin to load² **REQUIRED** |
|
||||||
| `init` | `null` | Lua code (as string of path) to call before loading the plugin |
|
| `init` | `null` | Lua code (as string of path) to call before loading the plugin |
|
||||||
| `config` | `null` | Lua code (as string of path) to call after loading the plugin |
|
| `config` | `null` | Lua code (as string of path) to call after loading the plugin |
|
||||||
| `dependencies` | `[]` | The plugin dependencies³ |
|
| `dependencies` | `[]` | The plugin dependencies³ |
|
||||||
| `lazy` | `false` | Should the plugin be loaded lazily |
|
| `extraLuaPackages` | `null` | Extra lua packages needed for the plugin |
|
||||||
| `cmd` | `[]` | Command to put as place_holder to load the lazy plugin⁴ |
|
| `lazy` | `false` | Should the plugin be loaded lazily |
|
||||||
| `ft` | `[]` | Filetype to watch to load the lazy plugin⁴ |
|
| `cmd` | `[]` | Command to put as place_holder to load the lazy plugin⁴ |
|
||||||
| `events` | `[]` | Events to watch to load the lazy plugin⁴⁵ |
|
| `ft` | `[]` | Filetype to watch to load the lazy plugin⁴ |
|
||||||
| `keymaps` | `[]` | Keymaps that when press will load the lazy plugin⁴⁶ |
|
| `events` | `[]` | Events to watch to load the lazy plugin⁴⁵ |
|
||||||
|
| `keymaps` | `[]` | Keymaps that when press will load the lazy plugin⁴⁶ |
|
||||||
|
|
||||||
> ² The plugin can be either a nix package or an object with only `name` and
|
> ² The plugin can be either a nix package or an object with only `name` and
|
||||||
> `src` as properties. The latter will be used to create a nix package of your
|
> `src` as properties. The latter will be used to create a nix package of your
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
package ? pkgs.neovim-unwrapped,
|
package ? pkgs.neovim-unwrapped,
|
||||||
dependencies ? [],
|
dependencies ? [],
|
||||||
dependenciesExtraArgs ? {},
|
dependenciesExtraArgs ? {},
|
||||||
|
extraLuaPackages ? (_: []),
|
||||||
runtime ? null,
|
runtime ? null,
|
||||||
init ? null,
|
init ? null,
|
||||||
viAlias ? false,
|
viAlias ? false,
|
||||||
|
|
@ -14,10 +15,10 @@
|
||||||
nvimdiffAlias ? false,
|
nvimdiffAlias ? false,
|
||||||
...
|
...
|
||||||
} @ config: let
|
} @ config: let
|
||||||
inherit (builtins) map isString isPath;
|
inherit (builtins) isString isPath map;
|
||||||
inherit (pkgs) callPackage bash lib;
|
inherit (pkgs) callPackage bash lib;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.lists) optional;
|
inherit (lib.lists) concatMap optional;
|
||||||
inherit (lib.trivial) flip;
|
inherit (lib.trivial) flip;
|
||||||
inherit (lib.attrsets) optionalAttrs;
|
inherit (lib.attrsets) optionalAttrs;
|
||||||
|
|
||||||
|
|
@ -36,6 +37,14 @@
|
||||||
extractPlugin = p: {inherit (p) optional plugin;};
|
extractPlugin = p: {inherit (p) optional plugin;};
|
||||||
extractPlugins = map extractPlugin;
|
extractPlugins = map extractPlugin;
|
||||||
|
|
||||||
|
extractLuaPackageFn = plugin:
|
||||||
|
optional (plugin ? extraLuaPackages) plugin.extraLuaPackages;
|
||||||
|
extractLuaPackagesFn = plugins: let
|
||||||
|
fnList = concatMap extractLuaPackageFn plugins;
|
||||||
|
concatPackages = ps: fn: fn ps;
|
||||||
|
in
|
||||||
|
ps: concatMap (concatPackages ps) fnList;
|
||||||
|
|
||||||
buildInit = {
|
buildInit = {
|
||||||
init ? null,
|
init ? null,
|
||||||
postInit ? null,
|
postInit ? null,
|
||||||
|
|
@ -81,6 +90,8 @@
|
||||||
pkgs.neovimUtils.makeNeovimConfig {
|
pkgs.neovimUtils.makeNeovimConfig {
|
||||||
inherit customRC;
|
inherit customRC;
|
||||||
plugins = extractPlugins plugins;
|
plugins = extractPlugins plugins;
|
||||||
|
extraLuaPackages = ps:
|
||||||
|
(extractLuaPackagesFn plugins ps) ++ (extraLuaPackages ps);
|
||||||
}
|
}
|
||||||
// {luaRcContent = customRC;};
|
// {luaRcContent = customRC;};
|
||||||
params =
|
params =
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,9 @@ in rec {
|
||||||
# Ensure thoses plugins are loaded before the current one
|
# Ensure thoses plugins are loaded before the current one
|
||||||
dependencies = option (list drv);
|
dependencies = option (list drv);
|
||||||
|
|
||||||
|
# Ensure those packages are available
|
||||||
|
extraLuaPackages = option function;
|
||||||
|
|
||||||
# Should this plugin be load lazily ?
|
# Should this plugin be load lazily ?
|
||||||
lazy = option bool;
|
lazy = option bool;
|
||||||
|
|
||||||
|
|
@ -114,6 +117,9 @@ in rec {
|
||||||
# Extra argument to pass to dependencies files
|
# Extra argument to pass to dependencies files
|
||||||
dependenciesExtraArgs = option (attrs any);
|
dependenciesExtraArgs = option (attrs any);
|
||||||
|
|
||||||
|
# Ensure those packages are available
|
||||||
|
extraLuaPackages = option function;
|
||||||
|
|
||||||
# Runtime configuration
|
# Runtime configuration
|
||||||
runtime = option runtimeType;
|
runtime = option runtimeType;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue