about summary refs log tree commit diff
path: root/pkgs/applications/editors/neovim
diff options
context:
space:
mode:
authorMatthieu Coudron <886074+teto@users.noreply.github.com>2023-11-22 00:42:43 +0100
committerMatthieu Coudron <886074+teto@users.noreply.github.com>2023-12-27 23:01:38 +0100
commit022cbac13d34b6f839b2e2c30837923d8cdab336 (patch)
tree8bc6a3b753de06808bad8db83a17a1dfeb3e20be /pkgs/applications/editors/neovim
parent032d45b46c6e39a864570628d9f110454dbf4c66 (diff)
downloadnixlib-022cbac13d34b6f839b2e2c30837923d8cdab336.tar
nixlib-022cbac13d34b6f839b2e2c30837923d8cdab336.tar.gz
nixlib-022cbac13d34b6f839b2e2c30837923d8cdab336.tar.bz2
nixlib-022cbac13d34b6f839b2e2c30837923d8cdab336.tar.lz
nixlib-022cbac13d34b6f839b2e2c30837923d8cdab336.tar.xz
nixlib-022cbac13d34b6f839b2e2c30837923d8cdab336.tar.zst
nixlib-022cbac13d34b6f839b2e2c30837923d8cdab336.zip
neovim: make generated wrapper args overridable
especially useful in home-manager to remove the generated options
Diffstat (limited to 'pkgs/applications/editors/neovim')
-rw-r--r--pkgs/applications/editors/neovim/wrapper.nix18
1 files changed, 8 insertions, 10 deletions
diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix
index 48c9c94e8e07..29146a769843 100644
--- a/pkgs/applications/editors/neovim/wrapper.nix
+++ b/pkgs/applications/editors/neovim/wrapper.nix
@@ -40,7 +40,9 @@ let
     , packpathDirs
     , ...
   }:
+  assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env.";
 
+  stdenv.mkDerivation (finalAttrs:
   let
 
     rcContent = ''
@@ -51,7 +53,7 @@ let
 
     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}"''
@@ -76,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.lua" rcContent}" ]
-      ++ 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;
@@ -93,9 +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 ''
@@ -123,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