tree-sitter-grammars: add grammarsScope package set
This allows overriding grammars with overlays
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
newScope,
|
||||
fetchFromGitHub,
|
||||
fetchFromGitLab,
|
||||
fetchFromSourcehut,
|
||||
@@ -68,6 +69,14 @@ let
|
||||
*/
|
||||
builtGrammars = lib.mapAttrs (_: lib.makeOverridable buildGrammar) grammars;
|
||||
|
||||
/**
|
||||
# Extensible package set for tree-sitter grammars.
|
||||
# Provides .override and .extend for customization.
|
||||
# Note: Use builtGrammars (not this) when iterating over grammars,
|
||||
# as this includes package set functions alongside derivations
|
||||
*/
|
||||
grammarsScope = lib.makeScope newScope (self: builtGrammars);
|
||||
|
||||
# Usage:
|
||||
# pkgs.tree-sitter.withPlugins (p: [ p.tree-sitter-c p.tree-sitter-java ... ])
|
||||
#
|
||||
@@ -183,6 +192,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
grammars
|
||||
buildGrammar
|
||||
builtGrammars
|
||||
grammarsScope
|
||||
withPlugins
|
||||
allGrammars
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user