This commit is contained in:
NotAShelf 2024-04-26 12:55:04 +03:00
parent 4b868d0de6
commit 94003faec6
No known key found for this signature in database
GPG Key ID: 02D1DD3FA08B6B29
2 changed files with 34 additions and 10 deletions

View File

@ -92,8 +92,10 @@ 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}"'');
extraWrapperArgs = concatStringsSep " " (optional (vimOptions.extraPackages != []) ''
--unset XDG_DATA_DIRS \
--prefix PATH : "${makeBinPath vimOptions.extraPackages}"
'');
# wrap user's desired neovim package with the desired neovim configuration
# using wrapNeovimUnstable and makeNeovimConfig from nixpkgs.
@ -119,6 +121,8 @@ in {
inherit (module) options config;
inherit (module._module.args) pkgs;
# expose wrapped neovim-package
neovim = neovim-wrapped;
# expose wrapped neovim package
neovim = neovim-wrapped.overrideAttrs (old: {
generatedWrapperArgs = (old.generatedWrapperArgs or []) ++ ["--set" "NVIM_APPNAME" "nvf"];
});
}

View File

@ -60,6 +60,13 @@ in {
path = ./runtime;
name = "nvim-runtime";
})
# as a Neovim plugin - pure, reproducible and follows Neovim practices
(pkgs.vimUtils.buildVimPlugin {
pname = "nvim-runtime";
src = ./nvim-runtime; # needs a plugin/init.lua, can refer to modules in a root level lua/ dir
version = "#";
})
]
'';
@ -133,14 +140,27 @@ in {
-- Remove default user runtime paths from the
-- `runtimepath` option to avoid leaking user configuration
-- into the final neovim wrapper
local defaultRuntimePaths = {
vim.fn.stdpath('config'), -- $HOME/.config/nvim
vim.fn.stdpath('config') .. "/after", -- $HOME/.config/nvim/after
vim.fn.stdpath('data') .. "/site", -- $HOME/.local/share/nvim/site
}
local defaultRuntimePaths = {}
local function addPath(path)
table.insert(defaultRuntimePaths, path)
table.insert(defaultRuntimePaths, path .. "/site")
end
-- Add standard paths to the table
addPath(vim.fn.stdpath('config')) -- $HOME/.config/nvim
addPath(vim.fn.stdpath('data')) -- $HOME/.local/share
addPath(vim.fn.stdpath('state')) -- $HOME/.local/state
addPath(vim.fn.stdpath('cache')) -- $HOME/.cache/nvim
addPath(vim.fn.stdpath('config_dirs'))
addPath(vim.fn.stdpath('data_dirs'))
for _, path in ipairs(defaultRuntimePaths) do
vim.opt.runtimepath:remove(path)
-- Check if the path exists in runtimepath before removing it
if vim.fn.index(vim.opt.runtimepath, path) >= 0 then
vim.opt.runtimepath:remove(path)
else
print("Path does not exist in runtimepath:", path)
end
end
''}