diff options
author | Profpatsch <mail@profpatsch.de> | 2021-01-16T13·09+0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-01-17T07·51+0000 |
commit | 9ea76fdf1ac08cd9b594ad37f6b963e78f818efc (patch) | |
tree | 51040e3772d4fec98a3472e4354e7e5b8ab8d666 /users/Profpatsch/rust-crates.nix | |
parent | e4976c49dc54a6bce0271dc291a27b721259f27b (diff) |
feat(users/Profpatsch): add a tree-sitter parser for nix r/2117
Uses the rust library to set up a simple nix parsing expression, which reads a nix file and prints the sexp tree. Change-Id: I32dc9c7b39aa0f7ffa2b99348d6c2269e5fe1a6a Reviewed-on: https://cl.tvl.fyi/c/depot/+/2402 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/rust-crates.nix')
-rw-r--r-- | users/Profpatsch/rust-crates.nix | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/users/Profpatsch/rust-crates.nix b/users/Profpatsch/rust-crates.nix new file mode 100644 index 000000000000..ebe6d73ceba9 --- /dev/null +++ b/users/Profpatsch/rust-crates.nix @@ -0,0 +1,53 @@ +{ depot, pkgs, ... }: +rec { + cfg-if = pkgs.buildRustCrate { + pname = "cfg-if"; + crateName = "cfg-if"; + version = "1.0.0"; + sha256 = "1fzidq152hnxhg4lj6r2gv4jpnn8yivp27z6q6xy7w6v0dp6bai9"; + }; + + cc = pkgs.buildRustCrate { + pname = "cc"; + crateName = "cc"; + version = "1.0.66"; + sha256 = "12q71z6ck8wlqrwgi25x3lrryyks9djymswn9b1c6qq0i01jpc1p"; + }; + + regex-syntax = pkgs.buildRustCrate { + pname = "regex-syntax"; + crateName = "regex-syntax"; + version = "0.6.22"; + sha256 = "0r00n2dgyixacl1sczqp18gxf0xh7x272hcdp62412lypba2gqyg"; + }; + + regex = pkgs.buildRustCrate { + pname = "regex"; + crateName = "regex"; + version = "1.4.3"; + features = [ "std" ]; + dependencies = [ regex-syntax ]; + sha256 = "0w0b4bh0ng20lf5y8raaxmxj46ikjqpgwy1iggzpby9lhv9vydkp"; + }; + + libloading = pkgs.buildRustCrate { + pname = "libloading"; + crateName = "libloading"; + version = "0.6.7"; + dependencies = [ cfg-if ]; + sha256 = "111d8zsizswnxiqn43vcgnc2ym9spsx1i6pcfp35ca3yw2ixq95j"; + }; + + tree-sitter = pkgs.buildRustCrate { + pname = "tree_sitter"; + crateName = "tree-sitter"; + # buildRustCrate isn’t really smart enough to detect the subdir + libPath = "binding_rust/lib.rs"; + # and the build.rs is also not where buildRustCrate would find it + build = "binding_rust/build.rs"; + version = "0.17.1"; + dependencies = [ regex ]; + buildDependencies = [ cc ]; + sha256 = "0jwwbvs4icpra7m1ycvnyri5h3sbw4qrfvgnnvnk72h4w93qhzhr"; + }; +} |