Comments (6)
I will love to work on this documentation. Kindly assign it to me.
from nix-editor.
Sounds great! I've assigned you the issue. Since the code is a bit messy I'd say the most important things to document at the moment are.
From read.rs:
From write.rs:
From parse.rs
A lot of it is pretty confusing, so please let me know if you have any questions! Also don't feel obligated to do all since there is a lot and the code is very convoluted. A lot of the code ties heavily in with the rnix crate: (https://docs.rs/rnix/0.10.2/rnix/), so most non-standard rust types are coming from there
from nix-editor.
Sounds great! I've assigned you the issue. Since the code is a bit messy I'd say the most important things to document at the moment are.
From read.rs:
From write.rs:
From parse.rs
A lot of it is pretty confusing, so please let me know if you have any questions! Also don't feel obligated to do all since there is a lot and the code is very convoluted. A lot of the code ties heavily in with the rnix crate: (https://docs.rs/rnix/0.10.2/rnix/), so most non-standard rust types are coming from there
Okay, I'd let you know if I have any question. I want to go through it. Thank you
from nix-editor.
from nix-editor.
Of course!
Basically, this project is a tool called nix-editor
which can be used to modify .nix
files programmatically while maintaining valid syntax. .nix
files are primarily used by NixOS and the Nix package manager to declaratively build packages and configurations (see: https://nixos.org/). The primary usage of this tool is so that other programs can modify .nix
files imperatively, some examples of tools using this are Nix Software Center and NixOS Configuration Editor. The tool also has a command line utility so that even programs not written in rust can take advantage of the functionality.
Here's a quick example of how it could be used, say we have a file default.nix
containing the following:
{
value1 = "Hello";
}
If we want to add another value to this attribute set, we could use nix-editor
as follows:
nix-editor default.nix value2 -v '"world!"' -o default.nix
Now the file default.nix
would contain
{
value1 = "Hello";
value2 = "world!";
}
While this tool does have a command line help screen, since there is no documentation for the backend function, trying to implement it into other rust programs can be difficult at the moment. The functions don't need very long descriptions, just a simple description or sentence should do, for example:
pub fn readvalue
/// Returns the value of the query from the given input string of `.nix` file text `f` and query `query`,
pub fn readvalue(f: &str, query: &str) -> Result<String, ReadError> {
from nix-editor.
Of course!
Basically, this project is a tool called
nix-editor
which can be used to modify.nix
files programmatically while maintaining valid syntax..nix
files are primarily used by NixOS and the Nix package manager to declaratively build packages and configurations (see: https://nixos.org/). The primary usage of this tool is so that other programs can modify.nix
files imperatively, some examples of tools using this are Nix Software Center and NixOS Configuration Editor. The tool also has a command line utility so that even programs not written in rust can take advantage of the functionality.Here's a quick example of how it could be used, say we have a file
default.nix
containing the following:{ value1 = "Hello"; }If we want to add another value to this attribute set, we could use
nix-editor
as follows:nix-editor default.nix value2 -v '"world!"' -o default.nix
Now the file
default.nix
would contain{ value1 = "Hello"; value2 = "world!"; }While this tool does have a command line help screen, since there is no documentation for the backend function, trying to implement it into other rust programs can be difficult at the moment. The functions don't need very long descriptions, just a simple description or sentence should do, for example:
pub fn readvalue
/// Returns the value of the query from the given input string of `.nix` file text `f` and query `query`, pub fn readvalue(f: &str, query: &str) -> Result<String, ReadError> {
okay, thank you. I will do a PR, i hope you will like it and merge it.
from nix-editor.
Related Issues (14)
- Switch argument parsing to clap
- read input from stdin or fd special file HOT 1
- interface could be better - similar to jq HOT 3
- Update to latest rnix version
- error: attribute 'defaultApp.x86_64-linux' should have type 'derivation' HOT 2
- [Suggestion] Make documentation about its usage
- formatting using alejandra
- Add support for nix flakes
- multiple updates HOT 1
- Create new attributes inside lambda HOT 5
- Handle imports recursively
- dont add newline on print HOT 1
- edit file in-place
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nix-editor.