summary refs log tree commit diff
path: root/pkgs/applications/editors/neovim/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/editors/neovim/default.nix')
-rw-r--r--pkgs/applications/editors/neovim/default.nix31
1 files changed, 27 insertions, 4 deletions
diff --git a/pkgs/applications/editors/neovim/default.nix b/pkgs/applications/editors/neovim/default.nix
index 9bf6fb51bdf..e183799d853 100644
--- a/pkgs/applications/editors/neovim/default.nix
+++ b/pkgs/applications/editors/neovim/default.nix
@@ -7,6 +7,7 @@
 , buildPackages
 , treesitter-parsers ? import ./treesitter-parsers.nix { inherit fetchurl; }
 , CoreServices
+, fixDarwinDylibNames
 , glibcLocales ? null, procps ? null
 
 # now defaults to false because some tests can be flaky (clipboard etc), see
@@ -16,8 +17,29 @@
 }:
 
 let
+  nvim-lpeg-dylib = luapkgs: if stdenv.isDarwin
+    then (luapkgs.lpeg.overrideAttrs (oa: {
+      preConfigure = ''
+        # neovim wants clang .dylib
+        sed -i makefile -e "s/CC = gcc/CC = clang/"
+        sed -i makefile -e "s/-bundle/-dynamiclib/"
+      '';
+      preBuild = ''
+        # there seems to be implicit calls to Makefile from luarocks, we need to
+        # add a stage to build our dylib
+        make macosx
+        mkdir -p $out/lib
+        mv lpeg.so $out/lib/lpeg.dylib
+      '';
+      nativeBuildInputs =
+        oa.nativeBuildInputs
+        ++ (
+          lib.optional stdenv.isDarwin fixDarwinDylibNames
+        );
+    }))
+    else luapkgs.lpeg;
   requiredLuaPkgs = ps: (with ps; [
-    lpeg
+    (nvim-lpeg-dylib ps)
     luabitop
     mpack
   ] ++ lib.optionals doCheck [
@@ -40,20 +62,21 @@ let
             deterministicStringIds = true;
             self = deterministicLuajit;
           };
-        in deterministicLuajit.withPackages(ps: [ ps.mpack ps.lpeg ])
+        in deterministicLuajit.withPackages(ps: [ ps.mpack (nvim-lpeg-dylib ps) ])
       else lua.luaOnBuild;
 
   pyEnv = python3.withPackages(ps: with ps; [ pynvim msgpack ]);
+
 in
   stdenv.mkDerivation rec {
     pname = "neovim-unwrapped";
-    version = "0.9.2";
+    version = "0.9.4";
 
     src = fetchFromGitHub {
       owner = "neovim";
       repo = "neovim";
       rev = "v${version}";
-      hash = "sha256-kKstlq1BzoBAy+gy9iL1auRViJ223cVpAt5X7pUWT1U=";
+      hash = "sha256-Lyo98cAs7Zhx23N4s4f3zpWFKYJMmXleWpt3wiVDQZo=";
     };
 
     patches = [