https://github.com/replit/nix-editor
an automatic editor for replit.nix files
https://github.com/replit/nix-editor
Last synced: 6 months ago
JSON representation
an automatic editor for replit.nix files
- Host: GitHub
- URL: https://github.com/replit/nix-editor
- Owner: replit
- License: mit
- Created: 2022-07-09T06:19:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-19T16:55:29.000Z (over 1 year ago)
- Last Synced: 2025-03-24T15:47:35.179Z (11 months ago)
- Language: Rust
- Size: 89.8 KB
- Stars: 9
- Watchers: 25
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
This program edits Replit's replit.nix editor that is used by Goval to modify programatically interact with the file.
It parses the file into an AST and traverses the AST to get the relevant information to modify the file.
run `cargo run -- --help` to see what cli arguments are available.
```
nix-editor
USAGE:
nix-editor [OPTIONS]
OPTIONS:
-a, --add
-d, --dep-type [default: regular] [possible values: regular, python]
-h, --human
--help Print help information
-p, --path
-r, --remove
--return-output
-v, --verbose
-V, --version Print version information
```
You can directly add/remove packages through the cli args like so `cargo run -- --add pkgs.cowsay` or `cargo run -- --remove pkgs.cowsay` or `cargo run -- --get`.
You can also run it without passing in any flags. If you do that, it reads json from stdin with the following structure:
```
{"op":"add", "dep": "pkgs.cowsay" }
```
# Contributing
* Please run `nix fmt` to format the code in this repository before making a pull request.
* `nix develop` will put you in a devshell with all the necessary development tools.