Skip to content

Commit

Permalink
fix(nix): add lpeg as a neovim dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
EdenEast committed Jun 16, 2023
1 parent 80e63e0 commit 90b9814
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions nix/overlays/neovim/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ inputs, ... }:
_final: prev:
final: prev:

# NixOS/nixpkgs#208103 introduced a patch that makes builds reproduceable.
# This patch applies to the current 0.8.2 but does not apply to nightly.
Expand All @@ -11,22 +11,48 @@ let
in patch != "neovim-build-make-generated-source-files-reproducible.patch"
)
v;

# This is only required as lpeg was added as a library dependency in pr: https://github.com/neovim/neovim/pull/23216
# This can be removed when 0.10 is released and nixpkgs is updated.
liblpeg = final.stdenv.mkDerivation {
pname = "liblpeg";
inherit (final.luajitPackages.lpeg) version meta src;

buildInputs = [ final.luajit ];

buildPhase = ''
sed -i makefile -e "s/CC = gcc/CC = clang/"
sed -i makefile -e "s/-bundle/-dynamiclib/"
make macosx
'';

installPhase = ''
mkdir -p $out/lib
mv lpeg.so $out/lib/lpeg.dylib
'';

nativeBuildInputs = [ final.fixDarwinDylibNames ];
};
in
{
neovim-unwrapped = inputs.neovim-flake.packages.${prev.system}.neovim.overrideAttrs (old: {
patches = patchFilter old.patches ++ [ ./0001-Add-nix-short-rev-to-pre-release-version-info.patch ];
NIX_SHORT_REV = inputs.neovim-flake.shortRev;
});
# neovim-unwrapped = inputs.neovim-flake.packages.${prev.system}.neovim.overrideAttrs (old: {
# patches = patchFilter old.patches ++ [ ./0001-Add-nix-short-rev-to-pre-release-version-info.patch ];
# NIX_SHORT_REV = inputs.neovim-flake.shortRev;
# });
neovim-nightly = inputs.neovim-flake.packages.${prev.system}.neovim.overrideAttrs (old: {
patches = patchFilter old.patches ++ [ ./0001-Add-nix-short-rev-to-pre-release-version-info.patch ];
# patches = patchFilter old.patches ++ [ ./0001-Add-nix-short-rev-to-pre-release-version-info.patch ];
patches = old.patches ++ [ ./0001-Add-nix-short-rev-to-pre-release-version-info.patch ];
NIX_SHORT_REV = inputs.neovim-flake.shortRev;
nativeBuildInputs = old.nativeBuildInputs ++ (prev.lib.optionals prev.stdenv.isDarwin [ liblpeg ]);
});
neovim-debug = inputs.neovim-flake.packages.${prev.system}.neovim-debug.overrideAttrs (old: {
patches = patchFilter old.patches ++ [ ./0001-Add-nix-short-rev-to-pre-release-version-info.patch ];
NIX_SHORT_REV = inputs.neovim-flake.shortRev;
nativeBuildInputs = old.nativeBuildInputs ++ (prev.lib.optionals prev.stdenv.isDarwin [ liblpeg ]);
});
neovim-developer = inputs.neovim-flake.packages.${prev.system}.neovim-developer.overrideAttrs (old: {
patches = patchFilter old.patches ++ [ ./0001-Add-nix-short-rev-to-pre-release-version-info.patch ];
NIX_SHORT_REV = inputs.neovim-flake.shortRev;
nativeBuildInputs = old.nativeBuildInputs ++ (prev.lib.optionals prev.stdenv.isDarwin [ liblpeg ]);
});
}

0 comments on commit 90b9814

Please sign in to comment.