1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00
This commit is contained in:
Matthieu Coudron 2025-03-31 02:12:12 +08:00 committed by GitHub
commit 2a7bf2c6e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 13 deletions

View file

@ -391,20 +391,19 @@ in {
suppressNotVimlConfig = p: suppressNotVimlConfig = p:
if p.type != "viml" then p // { config = null; } else p; if p.type != "viml" then p // { config = null; } else p;
neovimConfig = pkgs.neovimUtils.makeNeovimConfig { neovimConfig = pkgs.wrapNeovimUnstable cfg.package {
inherit (cfg) extraPython3Packages withPython3 withRuby viAlias vimAlias; inherit (cfg) extraPython3Packages withPython3 withRuby viAlias vimAlias;
withNodeJs = cfg.withNodeJs || cfg.coc.enable; withNodeJs = cfg.withNodeJs || cfg.coc.enable;
plugins = map suppressNotVimlConfig pluginsNormalized; plugins = map suppressNotVimlConfig pluginsNormalized;
customRC = cfg.extraConfig; # it gets ignored
}; neovimRcContent = cfg.extraConfig;
wrapperArgs = (lib.escapeShellArgs (cfg.extraWrapperArgs)) + " "
wrappedNeovim' = pkgs.wrapNeovimUnstable cfg.package (neovimConfig // { + extraMakeWrapperArgs + " " + extraMakeWrapperLuaCArgs + " "
wrapperArgs =
(lib.escapeShellArgs (neovimConfig.wrapperArgs ++ cfg.extraWrapperArgs))
+ " " + extraMakeWrapperArgs + " " + extraMakeWrapperLuaCArgs + " "
+ extraMakeWrapperLuaArgs; + extraMakeWrapperLuaArgs;
wrapRc = false; wrapRc = false;
}); };
wrappedNeovim' = neovimConfig;
in mkIf cfg.enable { in mkIf cfg.enable {
programs.neovim.generatedConfigViml = neovimConfig.neovimRcContent; programs.neovim.generatedConfigViml = neovimConfig.neovimRcContent;
@ -423,6 +422,14 @@ in {
home.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; }; home.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; };
# link the packpath in expected folder so that even unwrapped neovim can pick
# home-manager's plugins
xdg.dataFile."nvim/site/pack/hm" = let
packpathDirs.hm = neovimConfig.vimPackage;
in {
source = "${pkgs.neovimUtils.packDir packpathDirs}/pack/hm";
};
xdg.configFile = let xdg.configFile = let
hasLuaConfig = lib.hasAttr "lua" config.programs.neovim.generatedConfigs; hasLuaConfig = lib.hasAttr "lua" config.programs.neovim.generatedConfigs;
in lib.mkMerge ( in lib.mkMerge (

View file

@ -21,10 +21,9 @@ lib.mkIf config.test.enableBig {
_module.args.pkgs = lib.mkForce realPkgs; _module.args.pkgs = lib.mkForce realPkgs;
nmt.script = '' nmt.script = ''
vimout=$(mktemp) vimout=$out/nvim-output
echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | redir END" \ export HOME=$TESTED/home-files
| ${pkgs.neovim}/bin/nvim -es -u "$TESTED/home-files/.config/nvim/init.lua" \ ${pkgs.neovim-unwrapped}/bin/nvim -i NONE -V3$out/log.txt +"redir >> $vimout | echo g:hmExtraConfig | echo g:hmPlugins | redir END" +'exit'
> "$vimout" || true
assertFileContains "$vimout" "HM_EXTRA_CONFIG" assertFileContains "$vimout" "HM_EXTRA_CONFIG"
assertFileContains "$vimout" "HM_PLUGINS_CONFIG" assertFileContains "$vimout" "HM_PLUGINS_CONFIG"
''; '';