mirror of
https://github.com/isabelroses/nvim.git
synced 2025-04-09 13:29:34 +00:00
refactor: date versioning
This commit is contained in:
parent
a7afe929ea
commit
4bb27b0fa2
3 changed files with 24 additions and 16 deletions
|
@ -10,13 +10,20 @@
|
|||
grammars ? [ ],
|
||||
}:
|
||||
let
|
||||
inherit (builtins)
|
||||
map
|
||||
replaceStrings
|
||||
attrNames
|
||||
removeAttrs
|
||||
;
|
||||
|
||||
nv = callPackage ./_sources/generated.nix { };
|
||||
grammarOverrides = callPackage ./grammar-overrides.nix { };
|
||||
grammarOverrides = import ./grammar-overrides.nix;
|
||||
|
||||
# get all grammars from the nvfetcher output
|
||||
allGrammars = builtins.map (name: lib.removePrefix "treesitter-grammar-" name) (
|
||||
builtins.attrNames (
|
||||
builtins.removeAttrs nv [
|
||||
allGrammars = map (name: lib.removePrefix "treesitter-grammar-" name) (
|
||||
attrNames (
|
||||
removeAttrs nv [
|
||||
"nvim-treesitter"
|
||||
"override"
|
||||
"overrideDerivation"
|
||||
|
@ -28,27 +35,29 @@ let
|
|||
if (grammars == [ ]) then allGrammars else lib.intersectLists grammars allGrammars;
|
||||
|
||||
# build each Grammar
|
||||
treesitterGrammars = builtins.map (
|
||||
treesitterGrammars = map (
|
||||
name:
|
||||
let
|
||||
nvgrammar = nv."treesitter-grammar-${name}";
|
||||
in
|
||||
tree-sitter.buildGrammar (
|
||||
{
|
||||
inherit (nvgrammar) src version;
|
||||
inherit (nvgrammar) src;
|
||||
version = replaceStrings [ "-" ] [ "." ] nvgrammar.date;
|
||||
language = name;
|
||||
generate = lib.hasAttr "generate" nvgrammar;
|
||||
generate = nvgrammar ? "generate";
|
||||
location = nvgrammar.location or null;
|
||||
}
|
||||
// grammarOverrides.${name} or { }
|
||||
)
|
||||
) grammarsToBuild;
|
||||
|
||||
linkCommands = builtins.map (
|
||||
linkCommands = map (
|
||||
grammar:
|
||||
let
|
||||
name = lib.removeSuffix "-grammar" grammar.pname;
|
||||
in
|
||||
# bash
|
||||
''
|
||||
ln -sf ${grammar}/parser ./parser/${name}.so
|
||||
|
||||
|
@ -84,11 +93,15 @@ let
|
|||
'';
|
||||
|
||||
nvim-treesitter = vimUtils.buildVimPlugin {
|
||||
inherit (nv.nvim-treesitter) pname version src;
|
||||
inherit (nv.nvim-treesitter) pname src;
|
||||
|
||||
version = replaceStrings [ "-" ] [ "." ] nv.nvim-treesitter.date;
|
||||
|
||||
postPatch = lib.concatStrings linkCommands;
|
||||
|
||||
passthru = {
|
||||
grammars = treesitterGrammars;
|
||||
inherit neovim;
|
||||
tests = {
|
||||
inherit check-queries;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
nu = {
|
||||
postPatch = ''
|
||||
mv queries/nu/* queries/
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
{
|
||||
callPackage,
|
||||
neovim-unwrapped,
|
||||
neovimUtils,
|
||||
wrapNeovimUnstable,
|
||||
grammars ? [ ],
|
||||
}:
|
||||
let
|
||||
nvim-treesitter = callPackage ./default.nix { inherit grammars; };
|
||||
in
|
||||
wrapNeovimUnstable neovim-unwrapped (
|
||||
neovimUtils.makeNeovimConfig { plugins = [ nvim-treesitter ]; }
|
||||
)
|
||||
nvim-treesitter.passthru.neovim
|
||||
|
|
Loading…
Add table
Reference in a new issue