{"id":13647675,"url":"https://github.com/nix-community/rnix-parser","last_synced_at":"2026-02-16T20:30:36.357Z","repository":{"id":38419019,"uuid":"144383474","full_name":"nix-community/rnix-parser","owner":"nix-community","description":"A Nix parser written in Rust [maintainer=@oberblastmeister]","archived":false,"fork":false,"pushed_at":"2025-01-09T22:07:46.000Z","size":1005,"stargazers_count":391,"open_issues_count":16,"forks_count":45,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-08T11:24:36.277Z","etag":null,"topics":["nix","parser","rust"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nix-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"nix-community"}},"created_at":"2018-08-11T12:29:05.000Z","updated_at":"2025-05-06T07:44:16.000Z","dependencies_parsed_at":"2024-06-10T12:32:18.030Z","dependency_job_id":"141532fa-cbf4-4b20-a7fb-7eb61f23e007","html_url":"https://github.com/nix-community/rnix-parser","commit_stats":{"total_commits":295,"total_committers":26,"mean_commits":"11.346153846153847","dds":0.5627118644067797,"last_synced_commit":"11507d7b144b9572fb75b39ad18a1ea8eadf8b82"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Frnix-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Frnix-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Frnix-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Frnix-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nix-community","download_url":"https://codeload.github.com/nix-community/rnix-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253823701,"owners_count":21969891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nix","parser","rust"],"created_at":"2024-08-02T01:03:42.145Z","updated_at":"2026-02-16T20:30:36.281Z","avatar_url":"https://github.com/nix-community.png","language":"Nix","funding_links":["https://opencollective.com/nix-community"],"categories":["Nix","Rust","Development"],"sub_categories":[],"readme":"# rnix-parser [![Crates.io](https://img.shields.io/crates/v/rnix.svg)](http://crates.io/crates/rnix) [![Chat on Matrix](https://matrix.to/img/matrix-badge.svg)](https://matrix.to/#/#rnix-lsp:matrix.org)\n\nrnix is a parser for the [Nix language](https://nixos.org/nix/) written in Rust.\n\nThis can be used to manipulate the Nix AST and can for example be used for:\n\n- Interactively render Nix on a GUI\n- Formatting Nix code\n- Rename identifiers\n\nand a lot more!\n\nrnix nowadays uses [@matklad](https://github.com/matklad)'s\n[rowan](https://crates.io/crates/rowan) crate to ensure:\n\n- all span information is preserved, meaning you can use the AST to for\n  example apply highlighting\n- printing out the AST prints out 100% the original code. This is not an\n  over-exaggeration, even completely invalid nix code such as this README can\n  be intact after a parsing session (though the AST will mark errnous nodes)\n- easy ways to walk the tree without resorting to recursion\n\n## Demo\n\nExamples can be found in the `examples/` directory. \n\nYou may also want to see\n[nix-explorer](https://gitlab.com/jD91mZM2/nix-explorer): An example\nthat highlights AST nodes in Nix code. This demonstrates how\nwhitespaces and commands are preserved.\n\n## Hacking\n\nTests can be run with `cargo test`.\n\nIn order to update all `.expect`-files to the currently expected results,\nyou may run `UPDATE_TESTS=1 cargo test`.\n\nYou can parse Nix expressions from standard input using the `from-stdin` example.\nTo try that, run the following in your shell:\n\n```sh\necho \"[hello nix]\" | cargo run --quiet --example from-stdin\n```\n\n## Release Checklist\n\n* Ensure that all PRs that were scheduled for the release are merged (or optionally move\n  them to another milestone).\n* Close the milestone for the release (if any).\n* Run `cargo test` on `master` (or the branch to release from) with all changes being pulled in.\n* Apply the following patch to [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt):\n  ```diff\n  diff --git a/Cargo.toml b/Cargo.toml\n  index 0891350..edad471 100644\n  --- a/Cargo.toml\n  +++ b/Cargo.toml\n  @@ -13,6 +13,9 @@ repository = \"https://github.com/nix-community/nixpkgs-fmt\"\n   [workspace]\n   members = [ \"./wasm\" ]\n   \n  +[patch.crates-io]\n  +rnix = { path = \"/home/ma27/Projects/rnix-parser\" }\n  +\n   [dependencies]\n   rnix = \"0.9.0\"\n   smol_str = \"0.1.17\"\n  ```\n\n  and run `cargo test`.\n\n  While it's planned to add [fuzzing to `rnix-parser` as well](https://github.com/nix-community/rnix-parser/issues/32),\n  `nixpkgs-fmt` has a decent test-suite that would've helped to catch regressions in the past.\n\n  __Note:__ API changes are OK (and fixes should be contributed to `nixpkgs-fmt`), behavioral changes\n  are not unless explicitly discussed before.\n* Update the [CHANGELOG.md](https://github.com/nix-community/rnix-parser/blob/master/CHANGELOG.md).\n* Bump the version number in [Cargo.toml](https://github.com/nix-community/rnix-parser/blob/master/Cargo.toml) \u0026 re-run `cargo build` to refresh the lockfile.\n* Commit \u0026 run `nix build`.\n* Tag the release and push everything.\n* As soon as the CI has completed, run `cargo publish`.\n\n# RIP jd91mzm2\n\nSadly, the original author of this project, [@jD91mZM2 has passed\naway](https://www.redox-os.org/news/open-source-mental-health/). His online\npresence was anonymous and what we have left is his code. This is but one of\nhis many repos that he contributed to.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnix-community%2Frnix-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnix-community%2Frnix-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnix-community%2Frnix-parser/lists"}