aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2023-06-09 16:50:23 -0400
committerfigsoda <figsoda@pm.me>2023-06-09 16:51:26 -0400
commit8df3381202046ee5feeb9e9256d21f20a20531fb (patch)
tree6d91fd52a519358f85245fbc508be23a5a7f2658
parent9eef2b111d7ed1546509b75fd22e618e02dd3a73 (diff)
downloadrneovim-8df3381202046ee5feeb9e9256d21f20a20531fb.tar.gz
rneovim-8df3381202046ee5feeb9e9256d21f20a20531fb.tar.bz2
rneovim-8df3381202046ee5feeb9e9256d21f20a20531fb.zip
build(nix): use the correct versions of the bundled treesitter parsers
-rw-r--r--contrib/flake.nix41
1 files changed, 39 insertions, 2 deletions
diff --git a/contrib/flake.nix b/contrib/flake.nix
index 59d977b748..e4d0fae99f 100644
--- a/contrib/flake.nix
+++ b/contrib/flake.nix
@@ -7,13 +7,50 @@
};
outputs = { self, nixpkgs, flake-utils }:
+ let
+ inherit (builtins)
+ elemAt
+ foldl'
+ mapAttrs
+ match
+ readFile
+ ;
+ inherit (nixpkgs.lib)
+ const
+ flip
+ pipe
+ remove
+ splitString
+ toLower
+ ;
+ in
{
overlay = final: prev: {
- neovim = final.neovim-unwrapped.overrideAttrs (oa: rec {
+ neovim = (final.neovim-unwrapped.override {
+ treesitter-parsers = pipe ../cmake.deps/deps.txt [
+ readFile
+ (splitString "\n")
+ (map (match "TREESITTER_([A-Z_]+)_(URL|SHA256)[[:space:]]+([^[:space:]]+)[[:space:]]*"))
+ (remove null)
+ (flip foldl' { }
+ (acc: matches:
+ let
+ lang = toLower (elemAt matches 0);
+ type = toLower (elemAt matches 1);
+ value = elemAt matches 2;
+ in
+ acc // {
+ ${lang} = acc.${lang} or { } // {
+ ${type} = value;
+ };
+ }))
+ (mapAttrs (const final.fetchurl))
+ ];
+ }).overrideAttrs (oa: rec {
version = self.shortRev or "dirty";
src = ../.;
- preConfigure = ''
+ preConfigure = oa.preConfigure or "" + ''
sed -i cmake.config/versiondef.h.in -e 's/@NVIM_VERSION_PRERELEASE@/-dev-${version}/'
'';
nativeBuildInputs = oa.nativeBuildInputs ++ [