Skip to content

Commit

Permalink
neovim: improve lpeg patch for darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Oct 26, 2024
1 parent 3b67779 commit 669a36d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkgs/by-name/ne/neovim-unwrapped/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 669a36d

Please sign in to comment.