mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 05:19:48 +01:00
modules: switch to gerg's neovim-wrapper (#325)
* modules: switch to gerg's neovim-wrapper * Use initViml instead of writeText (#330) --------- Co-authored-by: diniamo <55629891+diniamo@users.noreply.github.com>
This commit is contained in:
parent
32d231395f
commit
5fab82ba91
3 changed files with 40 additions and 30 deletions
21
flake.lock
21
flake.lock
|
@ -88,6 +88,26 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"neovim-wrapper": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1720539383,
|
||||
"narHash": "sha256-HF4+pQJwgw62lLpWo5TiXFb8ui0FpZcb2TkSh9qXju8=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "neovim-wrapper",
|
||||
"rev": "a2b26accc1c414bc0ef0132ab167e2973dc26e68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Gerg-L",
|
||||
"repo": "neovim-wrapper",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nil": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
|
@ -1781,6 +1801,7 @@
|
|||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils": "flake-utils",
|
||||
"neovim-wrapper": "neovim-wrapper",
|
||||
"nil": "nil",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nmd": "nmd",
|
||||
|
|
|
@ -80,6 +80,12 @@
|
|||
flake-utils.url = "github:numtide/flake-utils";
|
||||
systems.url = "github:nix-systems/default";
|
||||
|
||||
# Alternate neovim-wrapper
|
||||
neovim-wrapper = {
|
||||
url = "github:Gerg-L/neovim-wrapper";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# For generating documentation website
|
||||
nmd = {
|
||||
url = "sourcehut:~rycee/nmd";
|
||||
|
|
|
@ -6,13 +6,11 @@ inputs: {
|
|||
extraSpecialArgs ? {},
|
||||
extraModules ? [],
|
||||
}: let
|
||||
inherit (builtins) map filter isString toString getAttr;
|
||||
inherit (pkgs) wrapNeovimUnstable vimPlugins;
|
||||
inherit (pkgs) vimPlugins;
|
||||
inherit (pkgs.vimUtils) buildVimPlugin;
|
||||
inherit (pkgs.neovimUtils) makeNeovimConfig;
|
||||
inherit (lib.strings) makeBinPath escapeShellArgs concatStringsSep;
|
||||
inherit (lib.lists) concatLists optional;
|
||||
inherit (lib.attrsets) recursiveUpdate;
|
||||
inherit (lib.strings) isString toString;
|
||||
inherit (lib.lists) filter map concatLists;
|
||||
inherit (lib.attrsets) recursiveUpdate getAttr;
|
||||
inherit (lib.asserts) assertMsg;
|
||||
|
||||
# import modules.nix with `check`, `pkgs` and `lib` as arguments
|
||||
|
@ -74,10 +72,6 @@ inputs: {
|
|||
optional = true;
|
||||
}) (buildConfigPlugins vimOptions.optPlugins);
|
||||
|
||||
# combine built start and optional plugins
|
||||
# into a single list
|
||||
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
|
||||
|
@ -85,29 +79,18 @@ inputs: {
|
|||
extraLuaPackages = ps: map (x: ps.${x}) vimOptions.luaPackages;
|
||||
extraPython3Packages = ps: map (x: ps.${x}) vimOptions.python3Packages;
|
||||
|
||||
extraWrapperArgs =
|
||||
concatStringsSep " " (optional (vimOptions.extraPackages != []) ''--prefix PATH : "${makeBinPath vimOptions.extraPackages}"'');
|
||||
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
|
||||
# generate a wrapped Neovim package.
|
||||
neovim-wrapped = inputs.neovim-wrapper.legacyPackages.${pkgs.stdenv.system}.neovimWrapper {
|
||||
neovim = vimOptions.package;
|
||||
plugins = concatLists [builtStartPlugins builtOptPlugins];
|
||||
wrapperArgs = ["--set" "NVIM_APPNAME" "nvf"];
|
||||
initViml = vimOptions.builtConfigRC;
|
||||
extraBinPath = 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)
|
||||
# - extraPython3Packages (lambda)
|
||||
# - withNodeJs (bool)
|
||||
# - withRuby (bool)
|
||||
# - extraLuaPackages (lambda)
|
||||
# - plugins (list)
|
||||
# - customRC (string)
|
||||
# and returns the wrapped package
|
||||
neovimConfigured = makeNeovimConfig {
|
||||
inherit (vimOptions) viAlias vimAlias withRuby withNodeJs withPython3;
|
||||
inherit plugins extraLuaPackages extraPython3Packages;
|
||||
customRC = vimOptions.builtConfigRC;
|
||||
inherit extraLuaPackages extraPython3Packages;
|
||||
};
|
||||
|
||||
neovim-wrapped = wrapNeovimUnstable vimOptions.package (recursiveUpdate neovimConfigured {
|
||||
wrapperArgs = escapeShellArgs neovimConfigured.wrapperArgs + " " + extraWrapperArgs;
|
||||
});
|
||||
in {
|
||||
inherit (module) options config;
|
||||
inherit (module._module.args) pkgs;
|
||||
|
|
Loading…
Reference in a new issue