git.iko.soy/typeable/nixpkgs
on master help sign in
neovim: add config to passthru (#101100)

first will register the config under the name init.vim which is more appropriate for neovim. Pass the generated config to passthru so that one can easily pass the current config to a raw/unwrapped neovim (helps with development). For instance, home-manager can reference the config in $XDG_CONFIG_HOME/nvim/init.vim without the need to wrap nvim with its config.

commit4c4c4874c49a47a40df6bc45e20124535253f36f authorMatthieu Coudron <mattator@gmail.com> dateTue 20 Oct 2020, 12:26 (6 years ago) parenta2ee5cb
2 files changed+9−6
pkgs/applications/editors/neovim/wrapper.nix+5−4 pkgs/misc/vim-plugins/vim-utils.nix+4−2
pkgs/applications/editors/neovim/wrapper.nix+5−4
@@ -1,5 +1,6 @@
11{ stdenv, symlinkJoin, lib, makeWrapper
22, vimUtils
3+, writeText
34, bundlerEnv, ruby
45, nodejs
56, nodePackages
@@ -110,9 +111,9 @@ let
110111 # https://github.com/neovim/neovim/issues/9413
111112 ++ lib.optionals (configure != {}) [
112113 "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim"
113− "--add-flags" "-u ${vimUtils.vimrcFile configure}"
114− ]
115− ;
114+ "--add-flags" "-u ${configFile}"
115+ ];
116+ configFile = writeText "init.vim" "${vimUtils.vimrcContent configure}";
116117 in
117118 symlinkJoin {
118119 name = "neovim-${stdenv.lib.getVersion neovim}";
@@ -181,7 +182,7 @@ let
181182 preferLocalBuild = true;
182183
183184 buildInputs = [makeWrapper];
184− passthru = { unwrapped = neovim; };
185+ passthru = { unwrapped = neovim; inherit configFile; };
185186
186187 meta = neovim.meta // {
187188 # To prevent builds on hydra
pkgs/misc/vim-plugins/vim-utils.nix+4−2
@@ -183,7 +183,7 @@ let
183183
184184 rtpPath = "share/vim-plugins";
185185
186− vimrcFile = {
186+ vimrcContent = {
187187 packages ? null,
188188 vam ? null,
189189 pathogen ? null,
@@ -338,7 +338,7 @@ let
338338 filetype indent plugin on | syn on
339339 '');
340340
341− in writeText "vimrc" ''
341+ in ''
342342 " configuration generated by NIX
343343 set nocompatible
344344
@@ -351,11 +351,13 @@ let
351351
352352 ${customRC}
353353 '';
354+ vimrcFile = settings: writeText "vimrc" (vimrcContent settings);
354355
355356in
356357
357358rec {
358359 inherit vimrcFile;
360+ inherit vimrcContent;
359361
360362 # shell script with custom name passing [-u vimrc] [-U gvimrc] to vim
361363 vimWithRC = {