From 4e8e483a4fc3d5422a69a43ebf9391bad2fd5caf Mon Sep 17 00:00:00 2001 From: Zexin Yuan Date: Sun, 30 Mar 2025 23:07:39 +0800 Subject: [PATCH] python3Packages.tree-sitter-c-sharp: init at 0.23.2 --- .../tree-sitter-c-sharp/default.nix | 59 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 61 insertions(+) create mode 100644 pkgs/development/python-modules/tree-sitter-c-sharp/default.nix diff --git a/pkgs/development/python-modules/tree-sitter-c-sharp/default.nix b/pkgs/development/python-modules/tree-sitter-c-sharp/default.nix new file mode 100644 index 000000000000..5b24e7d0f4be --- /dev/null +++ b/pkgs/development/python-modules/tree-sitter-c-sharp/default.nix @@ -0,0 +1,59 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + pythonOlder, + cargo, + rustPlatform, + rustc, + setuptools, + wheel, + tree-sitter, +}: + +let + version = "0.23.1"; + + src = fetchFromGitHub { + owner = "tree-sitter"; + repo = "tree-sitter-c-sharp"; + rev = "v${version}"; + hash = "sha256-weH0nyLpvVK/OpgvOjTuJdH2Hm4a1wVshHmhUdFq3XA="; + }; +in +buildPythonPackage { + pname = "tree-sitter-c-sharp"; + inherit version src; + pyproject = true; + disabled = pythonOlder "3.9"; + + cargoDeps = rustPlatform.fetchCargoVendor { + inherit src; + hash = "sha256-IogdMRj1eHRLtdNFdGNInpEQAAbRpM248GqkY+Mgu10="; + }; + + build-system = [ + cargo + rustPlatform.cargoSetupHook + rustc + setuptools + wheel + ]; + + optional-dependencies = { + core = [ + tree-sitter + ]; + }; + + pythonImportsCheck = [ + "tree_sitter_c_sharp" + ]; + + meta = { + description = "C# Grammar for tree-sitter"; + homepage = "https://github.com/tree-sitter/tree-sitter-c-sharp"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ yzx9 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 157e7314e4f7..f5c40f166652 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -17380,6 +17380,8 @@ self: super: with self; { tree-sitter = callPackage ../development/python-modules/tree-sitter { }; + tree-sitter-c-sharp = callPackage ../development/python-modules/tree-sitter-c-sharp { }; + tree-sitter-html = callPackage ../development/python-modules/tree-sitter-html { }; tree-sitter-javascript = callPackage ../development/python-modules/tree-sitter-javascript { };