All Projects → nix-community → rnix-parser

nix-community / rnix-parser

Licence: MIT license
A Nix parser written in Rust [maintainer=@oberblastmeister]

Programming Languages

Nix
1067 projects
rust
11053 projects

Labels

Projects that are alternatives of or similar to rnix-parser

nixpkgs-review-checks
Add additional checks and more information from build logs and outputs to the reports generated by nixpkgs-review.
Stars: ✭ 27 (-89.02%)
Mutual labels:  nix
impermanence
Modules to help you handle persistent state on systems with ephemeral root storage [maintainer=@talyz]
Stars: ✭ 401 (+63.01%)
Mutual labels:  nix
todomvc-nix
Example on how to nixify a project [maintainer=@Rizary]
Stars: ✭ 138 (-43.9%)
Mutual labels:  nix
nix-config
A collection of my system configs and dotfiles
Stars: ✭ 35 (-85.77%)
Mutual labels:  nix
nixos-configuration
A repo for my nixos configuration files
Stars: ✭ 20 (-91.87%)
Mutual labels:  nix
buildkit-nix
Nix derivations as Dockerfiles (`docker build -f default.nix .`)
Stars: ✭ 99 (-59.76%)
Mutual labels:  nix
nix-configs
My Nix{OS} configuration files
Stars: ✭ 54 (-78.05%)
Mutual labels:  nix
dotfiles-nix
Configuration files for my NixOS machine, declared by home-manager
Stars: ✭ 137 (-44.31%)
Mutual labels:  nix
release-services
Mozilla Release Engineering Services
Stars: ✭ 49 (-80.08%)
Mutual labels:  nix
nixvim
Configure Neovim with Nix!
Stars: ✭ 120 (-51.22%)
Mutual labels:  nix
yarn-plugin-nixify
Yarn v3 plugin to help with Nix packaging
Stars: ✭ 41 (-83.33%)
Mutual labels:  nix
nix bsd mac inventory
Collect Inventory data from *Nix, BSD and mac OS and upload to Device42
Stars: ✭ 17 (-93.09%)
Mutual labels:  nix
nixpkgs-pytools
Tools for removing the tedious nature of creating nixpkgs derivations [maintainer=@costrouc]
Stars: ✭ 36 (-85.37%)
Mutual labels:  nix
freebsd-ports-nix
Nix package manager port for the FreeBSD Ports Collection
Stars: ✭ 33 (-86.59%)
Mutual labels:  nix
markkarpov.com
My personal web site
Stars: ✭ 16 (-93.5%)
Mutual labels:  nix
nix-xdg
[WIP] Nix overlay for making programs xdg compliant
Stars: ✭ 18 (-92.68%)
Mutual labels:  nix
crane
A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.
Stars: ✭ 348 (+41.46%)
Mutual labels:  nix
nix-articles
Some articles about getting started with Nix programming & configuration
Stars: ✭ 134 (-45.53%)
Mutual labels:  nix
nix-home
A nix home development environment
Stars: ✭ 16 (-93.5%)
Mutual labels:  nix
nix-install-vendor-gl
Ensure that a system-compatible OpenGL driver is available for `nix-shell`-encapsulated programs.
Stars: ✭ 22 (-91.06%)
Mutual labels:  nix

rnix-parser Crates.io Chat on Matrix

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

  • Ensure that all PRs that were scheduled for the release are merged (or optionally move them to another milestone).

  • Close the milestone for the release (if any).

  • Run cargo test on master (or the branch to release from) with all changes being pulled in.

  • Apply the following patch to nixpkgs-fmt:

    diff --git a/Cargo.toml b/Cargo.toml
    index 0891350..edad471 100644
    --- a/Cargo.toml
    +++ b/Cargo.toml
    @@ -13,6 +13,9 @@ repository = "https://github.com/nix-community/nixpkgs-fmt"
     [workspace]
     members = [ "./wasm" ]
     
    +[patch.crates-io]
    +rnix = { path = "/home/ma27/Projects/rnix-parser" }
    +
     [dependencies]
     rnix = "0.9.0"
     smol_str = "0.1.17"

    and run cargo test.

    While it's planned to add fuzzing to rnix-parser as well, nixpkgs-fmt has a decent test-suite that would've helped to catch regressions in the past.

    Note: API changes are OK (and fixes should be contributed to nixpkgs-fmt), behavioral changes are not unless explicitly discussed before.

  • Update the CHANGELOG.md.

  • Bump the version number in Cargo.toml & re-run cargo build to refresh the lockfile.

  • Commit & run nix build.

  • Tag the release and push everything.

  • As soon as the CI has completed, run cargo publish.

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].