3 unstable releases

0.3.0 Jul 18, 2025
0.0.2 Jan 30, 2025
0.0.1 Mar 11, 2023

#157 in Parser implementations

Download history 8855/week @ 2025-12-25 12020/week @ 2026-01-01 16789/week @ 2026-01-08 17433/week @ 2026-01-15 25723/week @ 2026-01-22 22525/week @ 2026-01-29 54422/week @ 2026-02-05 58950/week @ 2026-02-12 81248/week @ 2026-02-19 92892/week @ 2026-02-26 107672/week @ 2026-03-05 106105/week @ 2026-03-12 68546/week @ 2026-03-19 53840/week @ 2026-03-26 70868/week @ 2026-04-02 77646/week @ 2026-04-09

285,244 downloads per month
Used in 40 crates (21 directly)

MIT license

620KB
23K SLoC

C 22K SLoC // 0.0% comments JavaScript 367 SLoC // 0.0% comments Scheme 115 SLoC // 0.3% comments Rust 33 SLoC // 0.4% comments

This crate provides nix language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

use tree_sitter::Parser;

let code = r#"
let
  b = a + 1;
  a = 1;
in
a + b
"#;
let mut parser = Parser::new();
let language = tree_sitter_nix::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading nix parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

tree-sitter-nix

Build Status

Nix grammar for tree-sitter.

Dependencies

~250KB