mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 19:11:15 +00:00
modules: pass extraPackages
to wrapper PATH
This commit is contained in:
parent
fecf9f48be
commit
2f4dcafaa3
2 changed files with 27 additions and 4 deletions
|
@ -10,7 +10,8 @@ inputs: {
|
||||||
inherit (pkgs) wrapNeovimUnstable vimPlugins;
|
inherit (pkgs) wrapNeovimUnstable vimPlugins;
|
||||||
inherit (pkgs.vimUtils) buildVimPlugin;
|
inherit (pkgs.vimUtils) buildVimPlugin;
|
||||||
inherit (pkgs.neovimUtils) makeNeovimConfig;
|
inherit (pkgs.neovimUtils) makeNeovimConfig;
|
||||||
inherit (lib.lists) concatLists;
|
inherit (lib.strings) makeBinPath escapeShellArgs concatStringsSep;
|
||||||
|
inherit (lib.lists) concatLists optional;
|
||||||
inherit (lib.attrsets) recursiveUpdate;
|
inherit (lib.attrsets) recursiveUpdate;
|
||||||
inherit (lib.asserts) assertMsg;
|
inherit (lib.asserts) assertMsg;
|
||||||
|
|
||||||
|
@ -82,11 +83,19 @@ inputs: {
|
||||||
|
|
||||||
plugins = builtStartPlugins ++ builtOptPlugins;
|
plugins = builtStartPlugins ++ builtOptPlugins;
|
||||||
|
|
||||||
|
# additional Lua and Python3 packages, mapped to their respective functions
|
||||||
|
# to conform to the format makeNeovimConfig expects. end user should
|
||||||
|
# only ever need to pass a list of packages, which are modified
|
||||||
|
# here
|
||||||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||||
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
||||||
|
|
||||||
# wrap user's desired neovim package using the neovim wrapper from nixpkgs
|
extraWrapperArgs =
|
||||||
# the wrapper takes the following arguments:
|
concatStringsSep " " (optional (vimOptions.extraPackages != []) ''--prefix PATH : "${makeBinPath vimOptions.extraPackages}"'');
|
||||||
|
|
||||||
|
# wrap user's desired neovim package with the desired neovim configuration
|
||||||
|
# using wrapNeovimUnstable and makeNeovimConfig from nixpkgs.
|
||||||
|
# the makeNeovimConfig function takes the following arguments:
|
||||||
# - withPython (bool)
|
# - withPython (bool)
|
||||||
# - extraPython3Packages (lambda)
|
# - extraPython3Packages (lambda)
|
||||||
# - withNodeJs (bool)
|
# - withNodeJs (bool)
|
||||||
|
@ -95,10 +104,14 @@ inputs: {
|
||||||
# - plugins (list)
|
# - plugins (list)
|
||||||
# - customRC (string)
|
# - customRC (string)
|
||||||
# and returns the wrapped package
|
# and returns the wrapped package
|
||||||
neovim-wrapped = wrapNeovimUnstable vimOptions.package (makeNeovimConfig {
|
neovimConfigured = makeNeovimConfig {
|
||||||
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
|
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
|
||||||
inherit plugins extraLuaPackages extraPython3Packages;
|
inherit plugins extraLuaPackages extraPython3Packages;
|
||||||
customRC = vimOptions.builtConfigRC;
|
customRC = vimOptions.builtConfigRC;
|
||||||
|
};
|
||||||
|
|
||||||
|
neovim-wrapped = wrapNeovimUnstable vimOptions.package (recursiveUpdate neovimConfigured {
|
||||||
|
wrapperArgs = escapeShellArgs neovimConfigured.wrapperArgs + " " + extraWrapperArgs;
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
inherit (module) options config;
|
inherit (module) options config;
|
||||||
|
|
|
@ -94,6 +94,16 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraPackages = mkOption {
|
||||||
|
type = listOf package;
|
||||||
|
default = [];
|
||||||
|
example = literalExpression ''[pkgs.fzf pkgs.ripgrep]'';
|
||||||
|
description = ''
|
||||||
|
List of additional packages to make available to the Neovim
|
||||||
|
wrapper.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
# this defaults to `true` in the wrapper
|
# this defaults to `true` in the wrapper
|
||||||
# and since we passs this value to the wrapper
|
# and since we passs this value to the wrapper
|
||||||
# with an inherit, it should be `true` here as well
|
# with an inherit, it should be `true` here as well
|
||||||
|
|
Loading…
Reference in a new issue