From 669a36de71a114c2779869292c25e0c9602fd990 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 26 Oct 2024 14:19:16 +0200 Subject: [PATCH] neovim: improve lpeg patch for darwin --- pkgs/by-name/ne/neovim-unwrapped/package.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ne/neovim-unwrapped/package.nix b/pkgs/by-name/ne/neovim-unwrapped/package.nix index a0d3700d6ee5a..9faa2c38e947b 100644 --- a/pkgs/by-name/ne/neovim-unwrapped/package.nix +++ b/pkgs/by-name/ne/neovim-unwrapped/package.nix @@ -33,18 +33,26 @@ stdenv.mkDerivation ( nvim-lpeg-dylib = luapkgs: if stdenv.hostPlatform.isDarwin then + let + luaLibDir = "$out/lib/lua/${lib.versions.majorMinor luapkgs.lua.luaversion}"; + in (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/" + sed -i makefile -e "s/lpeg.so/lpeg.dylib/" + sed -i makefile -e '/^linux:$/ {N; d;}' ''; 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 + mkdir -p ${luaLibDir} + mv lpeg.dylib ${luaLibDir}/lpeg.dylib + ''; + postInstall = '' + rm -f ${luaLibDir}/lpeg.so ''; nativeBuildInputs = oa.nativeBuildInputs ++ (lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames);