-
Notifications
You must be signed in to change notification settings - Fork 1
nix ASTs in JSON
License
abhillman/rnix-json
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
**rnix-json**
What this does:
* given a nix file, print its AST in JSON format
* given an AST of a nix file in JSON, print it as nix
**Rationale**
Using an intermediate representation of an AST in JSON can _may_ make it easier to modify a given AST. That said, this is an experiment!
**Examples**:
% cargo run --quiet -- example.nix | head -n10
{
"kind": "NODE_ROOT",
"text_range": [
0,
446
],
"children": [
{
"kind": "NODE_LAMBDA",
"text_range": [
% cargo run --quiet -- example.json | head -n10
{ config, pkgs, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
users.users.alice = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
packages = with pkgs; [
cowsay
**Disclaimer**
I am learning Rust! Much here may not be idiomatic.
**Acknowledgments**
Relies upon https://github.com/nix-community/rnix-parser.About
nix ASTs in JSON
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published