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.
This commit is contained in:
Matthieu Coudron 2020-10-20 12:26:39 +02:00 committed by GitHub
parent a2ee5cbb05
commit 4c4c4874c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,6 @@
{ stdenv, symlinkJoin, lib, makeWrapper { stdenv, symlinkJoin, lib, makeWrapper
, vimUtils , vimUtils
, writeText
, bundlerEnv, ruby , bundlerEnv, ruby
, nodejs , nodejs
, nodePackages , nodePackages
@ -110,9 +111,9 @@ let
# https://github.com/neovim/neovim/issues/9413 # https://github.com/neovim/neovim/issues/9413
++ lib.optionals (configure != {}) [ ++ lib.optionals (configure != {}) [
"--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim"
"--add-flags" "-u ${vimUtils.vimrcFile configure}" "--add-flags" "-u ${configFile}"
] ];
; configFile = writeText "init.vim" "${vimUtils.vimrcContent configure}";
in in
symlinkJoin { symlinkJoin {
name = "neovim-${stdenv.lib.getVersion neovim}"; name = "neovim-${stdenv.lib.getVersion neovim}";
@ -181,7 +182,7 @@ let
preferLocalBuild = true; preferLocalBuild = true;
buildInputs = [makeWrapper]; buildInputs = [makeWrapper];
passthru = { unwrapped = neovim; }; passthru = { unwrapped = neovim; inherit configFile; };
meta = neovim.meta // { meta = neovim.meta // {
# To prevent builds on hydra # To prevent builds on hydra

View File

@ -183,7 +183,7 @@ let
rtpPath = "share/vim-plugins"; rtpPath = "share/vim-plugins";
vimrcFile = { vimrcContent = {
packages ? null, packages ? null,
vam ? null, vam ? null,
pathogen ? null, pathogen ? null,
@ -338,7 +338,7 @@ let
filetype indent plugin on | syn on filetype indent plugin on | syn on
''); '');
in writeText "vimrc" '' in ''
" configuration generated by NIX " configuration generated by NIX
set nocompatible set nocompatible
@ -351,11 +351,13 @@ let
${customRC} ${customRC}
''; '';
vimrcFile = settings: writeText "vimrc" (vimrcContent settings);
in in
rec { rec {
inherit vimrcFile; inherit vimrcFile;
inherit vimrcContent;
# shell script with custom name passing [-u vimrc] [-U gvimrc] to vim # shell script with custom name passing [-u vimrc] [-U gvimrc] to vim
vimWithRC = { vimWithRC = {