NixOS/rnix-parser
关于
使用 Rust 编写的 Nix 解析器 [维护者=@philiptaron]
开发工具实测星标增长
- 24小时
- +1
- 7天
- +2
- 15天
- +5
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文rnix-parser

rnix is a parser for the Nix language written in Rust.
This can be used to manipulate the Nix AST and can for example be used for:
- Interactively render Nix on a GUI
- Formatting Nix code
- Rename identifiers
and a lot more!
rnix nowadays uses @matklad's rowan crate to ensure:
- all span information is preserved, meaning you can use the AST to for example apply highlighting
- printing out the AST prints out 100% the original code. This is not an over-exaggeration, even completely invalid nix code such as this README can be intact after a parsing session (though the AST will mark errnous nodes)
- easy ways to walk the tree without resorting to recursion
Demo
Examples can be found in the examples/ directory.
You may also want to see nix-explorer: An example that highlights AST nodes in Nix code. This demonstrates how whitespaces and commands are preserved.
Hacking
Tests can be run with cargo test.
In order to update all .expect-files to the currently expected results,
you may run UPDATE_TESTS=1 cargo test.
You can parse Nix expressions from standard input using the from-stdin example.
To try that, run the following in your shell:
echo "[hello nix]" | cargo run --quiet --example from-stdin
Release Checklist
- In CHANGELOG.md, add a
## [vX.Y.Z] - YYYY-MM-DDheading below## [Unreleased], add a[vX.Y.Z]compare link at the bottom, and point the[Unreleased]link atvX.Y.Z...master. - Bump
versionin Cargo.toml. - Refresh the lockfiles:
cargo update -w && cargo update -w --manifest-path fuzz/Cargo.toml. - Run
cargo test,nix buildandcargo publish --dry-run. - Commit as
chore: release vX.Y.Zon a branch, open a PR, and add it to the merge queue. - Once it merges, tag the release commit
vX.Y.Zand push the tag. - Approve the
releaseworkflow run the tag started. It checks that the tag is onmasterand matchesCargo.toml, publishes to crates.io, and creates the GitHub release from the changelog section. - Check the new version on crates.io and the GitHub release.
RIP jd91mzm2
Sadly, the original author of this project, @jD91mZM2 has passed away. His online presence was anonymous and what we have left is his code. This is but one of his many repos that he contributed to.
探索相关项目
加载中…