8000 GitHub - abhillman/rnix-json: nix ASTs in JSON
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

abhillman/rnix-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

No packages published
0