about summary refs log tree commit diff
path: root/pkgs/applications/editors/neovim
diff options
context:
space:
mode:
authorMatthieu Coudron <mcoudron@hotmail.com>2023-06-12 22:54:57 +0200
committerMatthieu Coudron <886074+teto@users.noreply.github.com>2023-09-28 23:33:43 +0200
commit7d810bf8a43a3f10a476e7475861fab00e160ff8 (patch)
tree5873b849dd9a2f4b50a09dc86ff57bf2591de850 /pkgs/applications/editors/neovim
parent7fb0efd757a1e12e51951b6e0f127d3fdabd0e66 (diff)
downloadnixlib-7d810bf8a43a3f10a476e7475861fab00e160ff8.tar
nixlib-7d810bf8a43a3f10a476e7475861fab00e160ff8.tar.gz
nixlib-7d810bf8a43a3f10a476e7475861fab00e160ff8.tar.bz2
nixlib-7d810bf8a43a3f10a476e7475861fab00e160ff8.tar.lz
nixlib-7d810bf8a43a3f10a476e7475861fab00e160ff8.tar.xz
nixlib-7d810bf8a43a3f10a476e7475861fab00e160ff8.tar.zst
nixlib-7d810bf8a43a3f10a476e7475861fab00e160ff8.zip
neovim: enable structured attributes
Diffstat (limited to 'pkgs/applications/editors/neovim')
-rw-r--r--pkgs/applications/editors/neovim/wrapper.nix32
1 files changed, 23 insertions, 9 deletions
diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix
index 0fbb54df01ac..b19126b70c90 100644
--- a/pkgs/applications/editors/neovim/wrapper.nix
+++ b/pkgs/applications/editors/neovim/wrapper.nix
@@ -7,7 +7,10 @@
 , neovimUtils
 , vimUtils
 , perl
+, lndir
 }:
+
+# unwrapped neovim
 neovim:
 
 let
@@ -72,8 +75,14 @@ let
   in
   assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env.";
 
-  symlinkJoin {
+  stdenv.mkDerivation (finalAttrs: {
       name = "neovim-${lib.getVersion neovim}${extraName}";
+
+      __structuredAttrs = true;
+      dontUnpack = true;
+      inherit viAlias vimAlias withNodeJs withPython3 withPerl;
+      inherit providerLuaRc packpathDirs;
+
       # Remove the symlinks created by symlinkJoin which we need to perform
       # extra actions upon
       postBuild = lib.optionalString stdenv.isLinux ''
@@ -81,22 +90,22 @@ let
         substitute ${neovim}/share/applications/nvim.desktop $out/share/applications/nvim.desktop \
           --replace 'Name=Neovim' 'Name=Neovim wrapper'
       ''
-      + lib.optionalString withPython3 ''
+      + lib.optionalString finalAttrs.withPython3 ''
         makeWrapper ${python3Env.interpreter} $out/bin/nvim-python3 --unset PYTHONPATH
       ''
       + lib.optionalString (rubyEnv != null) ''
         ln -s ${rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby
       ''
-      + lib.optionalString withNodeJs ''
+      + lib.optionalString finalAttrs.withNodeJs ''
         ln -s ${nodePackages.neovim}/bin/neovim-node-host $out/bin/nvim-node
       ''
-      + lib.optionalString withPerl ''
+      + lib.optionalString finalAttrs.withPerl ''
         ln -s ${perlEnv}/bin/perl $out/bin/nvim-perl
       ''
-      + lib.optionalString vimAlias ''
+      + lib.optionalString finalAttrs.vimAlias ''
         ln -s $out/bin/nvim $out/bin/vim
       ''
-      + lib.optionalString viAlias ''
+      + lib.optionalString finalAttrs.viAlias ''
         ln -s $out/bin/nvim $out/bin/vi
       ''
       + lib.optionalString (manifestRc != null) (let
@@ -139,11 +148,16 @@ let
         makeWrapper ${lib.escapeShellArgs finalMakeWrapperArgs} ${wrapperArgsStr}
       '';
 
-    paths = [ neovim ];
+    buildPhase = ''
+      mkdir -p $out
+      for i in ${neovim}; do
+        lndir -silent $i $out
+      done
+    '';
 
     preferLocalBuild = true;
 
-    nativeBuildInputs = [ makeWrapper ];
+    nativeBuildInputs = [ makeWrapper lndir ];
     passthru = {
       inherit providerLuaRc packpathDirs;
       unwrapped = neovim;
@@ -159,6 +173,6 @@ let
       # prefer wrapper over the package
       priority = (neovim.meta.priority or 0) - 1;
     };
-  };
+  });
 in
   lib.makeOverridable wrapper