new lazy rice

This commit is contained in:
iofq 2024-08-19 01:38:09 -05:00
parent 1eb2b1bc3c
commit ece2c1c694
33 changed files with 1132 additions and 780 deletions

View file

@ -91,60 +91,38 @@ with lib;
src = nvimRtpSrc;
buildPhase = ''
mkdir -p $out/nvim
mkdir -p $out/lua
rm init.lua
'';
installPhase = ''
cp -r after $out/after
rm -r after
cp -r lua $out/lua
rm -r lua
cp -r * $out/nvim
'';
};
# The final init.lua content that we pass to the Neovim wrapper.
# It wraps the user init.lua, prepends the lua lib directory to the RTP
# and prepends the nvim and after directory to the RTP
# It also adds logic for bootstrapping dev plugins (for plugin developers)
initLua =
''
vim.loader.enable()
-- prepend lua directory
initLua = ''
vim.opt.rtp:prepend('${nvimRtp}/lua')
''
# Wrap init.lua
+ (builtins.readFile ../nvim/init.lua)
# Bootstrap/load dev plugins
+ optionalString (devPlugins != []) (
''
local dev_pack_path = vim.fn.stdpath('data') .. '/site/pack/dev'
local dev_plugins_dir = dev_pack_path .. '/opt'
local dev_plugin_path
''
+ strings.concatMapStringsSep
"\n"
(plugin: ''
dev_plugin_path = dev_plugins_dir .. '/${plugin.name}'
if vim.fn.empty(vim.fn.glob(dev_plugin_path)) > 0 then
vim.notify('Bootstrapping dev plugin ${plugin.name} ...', vim.log.levels.INFO)
vim.cmd('!${pkgs.git}/bin/git clone ${plugin.url} ' .. dev_plugin_path)
end
vim.cmd('packadd! ${plugin.name}')
'')
devPlugins
)
# Prepend nvim and after directories to the runtimepath
# NOTE: This is done after init.lua,
# because of a bug in Neovim that can cause filetype plugins
# to be sourced prematurely, see https://github.com/neovim/neovim/issues/19008
# We prepend to ensure that user ftplugins are sourced before builtin ftplugins.
+ ''
vim.opt.rtp:prepend('${nvimRtp}/nvim')
vim.opt.rtp:prepend('${nvimRtp}/after')
'';
lazy_opts = {
performance = {
reset_packpath = false,
rtp = { reset = false, },
},
dev = {
path = "${pkgs.neovimUtils.packDir neovimConfig.packpathDirs}/pack/myNeovimPackages/start",
patterns = {""},
},
install = { missing = false, },
spec = {{ import = "plugins" }},
disabled_plugins = {
"netrwPlugin",
"tutor",
"zipPlugin",
},
}
'' + (builtins.readFile ../nvim/init.lua);
# Add arguments to the Neovim wrapper script
extraMakeWrapperArgs = builtins.concatStringsSep " " (