neovim: attempt at reusing nixpkgs upstream config
This commit is contained in:
+31
-25
@@ -433,30 +433,40 @@ in
|
||||
(lib.makeBinPath cfg.extraPackages)
|
||||
];
|
||||
|
||||
vimPackageInfo = neovimUtils.makeVimPackageInfo (map suppressIncompatibleConfig pluginsNormalized);
|
||||
nixpkgsCompatiblePlugins = map suppressIncompatibleConfig pluginsNormalized;
|
||||
vimPackageInfo = neovimUtils.makeVimPackageInfo nixpkgsCompatiblePlugins;
|
||||
|
||||
wrappedNeovim' = pkgs.wrapNeovimUnstable cfg.package {
|
||||
withNodeJs = cfg.withNodeJs || cfg.coc.enable;
|
||||
plugins = [ ];
|
||||
wrappedNeovim' =
|
||||
(pkgs.wrapNeovimUnstable cfg.package {
|
||||
withNodeJs = cfg.withNodeJs || cfg.coc.enable;
|
||||
plugins = nixpkgsCompatiblePlugins;
|
||||
|
||||
extraLuaPackages = lp: cfg.extraLuaPackages lp ++ vimPackageInfo.luaDependencies;
|
||||
inherit (cfg)
|
||||
extraName
|
||||
withPython3
|
||||
withRuby
|
||||
withPerl
|
||||
viAlias
|
||||
vimAlias
|
||||
autowrapRuntimeDeps
|
||||
waylandSupport
|
||||
;
|
||||
extraLuaPackages = lp: cfg.extraLuaPackages lp ++ vimPackageInfo.luaDependencies;
|
||||
inherit (cfg)
|
||||
extraName
|
||||
withPython3
|
||||
withRuby
|
||||
withPerl
|
||||
viAlias
|
||||
vimAlias
|
||||
autowrapRuntimeDeps
|
||||
waylandSupport
|
||||
;
|
||||
|
||||
extraPython3Packages =
|
||||
ps: (cfg.extraPython3Packages ps) ++ (lib.concatMap (f: f ps) vimPackageInfo.pluginPython3Packages);
|
||||
neovimRcContent = cfg.extraConfig;
|
||||
wrapperArgs = cfg.extraWrapperArgs ++ extraMakeWrapperArgs;
|
||||
wrapRc = false;
|
||||
};
|
||||
extraPython3Packages =
|
||||
ps: (cfg.extraPython3Packages ps) ++ (lib.concatMap (f: f ps) vimPackageInfo.pluginPython3Packages);
|
||||
neovimRcContent = cfg.extraConfig;
|
||||
wrapperArgs = cfg.extraWrapperArgs ++ extraMakeWrapperArgs;
|
||||
wrapRc = false;
|
||||
}).overrideAttrs
|
||||
{
|
||||
|
||||
# nixpkgs implementation dependend: avoid nixpkgs adding rtp/packpath wrapping arguments
|
||||
packpathDirs.myNeovimPackages = {
|
||||
start = [ ];
|
||||
opt = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
# This is a hack to avoid breaking config for users that dont want an init.lua to get generated
|
||||
# See https://github.com/nix-community/home-manager/pull/8734
|
||||
@@ -512,12 +522,8 @@ in
|
||||
else
|
||||
null;
|
||||
|
||||
advisedLua = foldedLuaBlock "home-manager generated: plugin config advised in nixpkgs" (
|
||||
lib.concatStringsSep "\n" vimPackageInfo.pluginAdvisedLua
|
||||
);
|
||||
in
|
||||
lib.mkMerge [
|
||||
(lib.mkIf (advisedLua != null) (lib.mkOrder 510 advisedLua))
|
||||
(lib.mkIf wrapperHasUserConfig (
|
||||
# we want it to appear rather early
|
||||
lib.mkOrder 200 wrappedNeovim'.luaRcContent
|
||||
|
||||
@@ -4,6 +4,7 @@ package.cpath = "/nix/store/00000000000000000000000000000000-luajit/lib/lua/5.1/
|
||||
vim.g.loaded_node_provider=0;vim.g.loaded_perl_provider=0;vim.g.loaded_ruby_provider=0;vim.g.python3_host_prog='/nix/store/00000000000000000000000000000000-nvim-host-python3/bin/nvim-python3'
|
||||
vim.cmd.source "/nix/store/00000000000000000000000000000000-init.vim"
|
||||
|
||||
vim.g.Unicode_data_directory="/nix/store/00000000000000000000000000000000-vimplugin-unicode.vim/autoload/unicode"
|
||||
-- user-associated plugin config {{{
|
||||
function HM_PLUGIN_LUA_CONFIG ()
|
||||
end
|
||||
|
||||
@@ -16,18 +16,24 @@ lib.mkIf config.test.enableBig {
|
||||
vim-nix
|
||||
{
|
||||
plugin = vim-commentary;
|
||||
# testing viml config
|
||||
config = ''
|
||||
let g:hmPlugins='HM_PLUGINS_CONFIG'
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = vim-nix;
|
||||
# testing lua config
|
||||
type = "lua";
|
||||
config = ''
|
||||
function HM_PLUGIN_LUA_CONFIG ()
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
# to test passthru.initLua is taken into account
|
||||
plugin = unicode-vim;
|
||||
}
|
||||
];
|
||||
extraLuaPackages = ps: [ ps.luautf8 ];
|
||||
};
|
||||
@@ -42,11 +48,13 @@ lib.mkIf config.test.enableBig {
|
||||
in
|
||||
''
|
||||
vimout=$(mktemp)
|
||||
echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | redir END" \
|
||||
echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | echo g:Unicode_data_directory | redir END" \
|
||||
| ${pkgs.neovim}/bin/nvim -es -u "$TESTED/home-files/.config/nvim/init.lua" \
|
||||
> "$vimout" || true
|
||||
assertFileContains "$vimout" "HM_EXTRA_CONFIG"
|
||||
assertFileContains "$vimout" "HM_PLUGINS_CONFIG"
|
||||
# testing that unicode-vim's value is echoed
|
||||
assertFileContains "$vimout" "autoload/unicode"
|
||||
|
||||
initLua="$TESTED/home-files/.config/nvim/init.lua"
|
||||
assertFileContent $(normalizeStorePaths "$initLua") ${./plugin-config.expected}
|
||||
|
||||
Reference in New Issue
Block a user