Hi,
I want to maintain my plugin setup functions in lua, but manage their install using nix. I don’t really want to translate/embed my lua to/in nix, because I want LSP support and formatting when I configure my Neovim config.
I am aiming to source a lua config file per plugin in my default.nix, a bit like this:
programs.neovim.plugins = with pkgs.vimPlugins [
[...]
nvim-lspconfig
{
plugin = telescoep-nvim;
type = "lua";
config = builtins.readFile(./nvim/plugins/telescope.lua)
}
{
plugin = oil-nvim;
type = "lua";
config = builtins.readFile(./nvim/plugins/oil.lua)
}
[...]
];
The issue, is that I would like to “require” other lua files in my plugin config files, so that I can maintain a modular structure (e.g. import from mappings.lua, autocommands.lua etc…), however the plugin config file ends up in the nix store and so importing the other lua modules doesn’t work.
Does anyone have a solution for this problem?
I could probably do some lua wizardry to import modules with an absolute path, but it seems a bit hacky.
Many thanks for any help