I remember I start experiencing this issue around NixOS 24.04 was rolling out. Neovim works fine, but when invoked with sudoedit
, it won’t be able to find plugins under Nix store:
Error detected while processing /home/hftsai/.dotfiles/xdg_config/nvim/init.lua:
E5113: Error while calling lua chunk: vim/_editor.lua:0: /home/hftsai/.dotfiles/xdg_config/nvim/init.lua..nvim_exec2() called at /home/hftsai/.dotfiles/xdg_c
onfig/nvim/init.lua:0: Vim(colorscheme):E185: Cannot find color scheme 'hybrid'
This is the full configuration tree, but I think the relative part of the module (neovim/default.nix
) is:
{ config, pkgs, ... }:
let
inherit (config.lib.file) mkOutOfStoreSymlink;
inherit (config.home) homeDirectory;
in
{
xdg.configFile."nvim".source = mkOutOfStoreSymlink "${homeDirectory}/.dotfiles/xdg_config/nvim";
programs.neovim = {
enable = true;
defaultEditor = true;
plugins = [
pkgs.vimPlugins.vim-hybrid
];
};
}
Is it because I’m introducing the config LUAs by mkOutOfStoreSymlink
, so that some magics are missing when run from sudoedit
?