diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-01-06 02:12:23 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-01-06 02:12:23 +0100 |
commit | f34a1b70eb86e4a63cfb88ea460345bb1aed88e3 (patch) | |
tree | 32834d23912250e0c4b86aa4420baacf8091c0fe /nixpkgs/pkgs/applications/editors/neovim/wrapper.nix | |
parent | 003ab91dd67b093890db1dd0bab564345db6e496 (diff) | |
parent | 7a7cfff8915e06365bc2365ff33d4d413184fa9f (diff) | |
download | nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.gz nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.bz2 nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.lz nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.xz nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.zst nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.zip |
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/applications/editors/neovim/wrapper.nix')
-rw-r--r-- | nixpkgs/pkgs/applications/editors/neovim/wrapper.nix | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/applications/editors/neovim/wrapper.nix b/nixpkgs/pkgs/applications/editors/neovim/wrapper.nix index d61a2fe5e5a8..29146a769843 100644 --- a/nixpkgs/pkgs/applications/editors/neovim/wrapper.nix +++ b/nixpkgs/pkgs/applications/editors/neovim/wrapper.nix @@ -32,16 +32,28 @@ let # set to false if you want to control where to save the generated config # (e.g., in ~/.config/init.vim or project/.nvimrc) , wrapRc ? true - , neovimRcContent ? "" + # vimL code that should be sourced as part of the generated init.lua file + , neovimRcContent ? null + # lua code to put into the generated init.lua file + , luaRcContent ? "" # entry to load in packpath , packpathDirs , ... }: + assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env."; + + stdenv.mkDerivation (finalAttrs: let + rcContent = '' + ${luaRcContent} + '' + lib.optionalString (!isNull neovimRcContent) '' + vim.cmd.source "${writeText "init.vim" neovimRcContent}" + ''; + wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs; - commonWrapperArgs = + generatedWrapperArgs = # vim accepts a limited number of commands so we join them all [ "--add-flags" ''--cmd "lua ${providerLuaRc}"'' @@ -66,15 +78,12 @@ let finalMakeWrapperArgs = [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim" ] ++ [ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ] - ++ lib.optionals wrapRc [ "--add-flags" "-u ${writeText "init.vim" neovimRcContent}" ] - ++ commonWrapperArgs + ++ lib.optionals finalAttrs.wrapRc [ "--add-flags" "-u ${writeText "init.lua" rcContent}" ] + ++ finalAttrs.generatedWrapperArgs ; perlEnv = perl.withPackages (p: [ p.NeovimExt p.Appcpanminus ]); - in - assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env."; - - stdenv.mkDerivation (finalAttrs: { + in { name = "neovim-${lib.getVersion neovim-unwrapped}${extraName}"; __structuredAttrs = true; @@ -83,8 +92,8 @@ let inherit wrapRc providerLuaRc packpathDirs; inherit python3Env rubyEnv; withRuby = rubyEnv != null; - inherit wrapperArgs; - + inherit wrapperArgs generatedWrapperArgs; + luaRcContent = rcContent; # Remove the symlinks created by symlinkJoin which we need to perform # extra actions upon postBuild = lib.optionalString stdenv.isLinux '' @@ -112,7 +121,7 @@ let '' + lib.optionalString (manifestRc != null) (let manifestWrapperArgs = - [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim-wrapper" ] ++ commonWrapperArgs; + [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim-wrapper" ] ++ finalAttrs.generatedWrapperArgs; in '' echo "Generating remote plugin manifest" export NVIM_RPLUGIN_MANIFEST=$out/rplugin.vim |