Code Monkey home page Code Monkey logo

Comments (6)

Adelakin-Adewumi avatar Adelakin-Adewumi commented on July 24, 2024

I will love to work on this documentation. Kindly assign it to me.

from nix-editor.

vlinkz avatar vlinkz commented on July 24, 2024

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.

Adelakin-Adewumi avatar Adelakin-Adewumi commented on July 24, 2024

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.

Adelakin-Adewumi avatar Adelakin-Adewumi commented on July 24, 2024

from nix-editor.

vlinkz avatar vlinkz commented on July 24, 2024

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.

Adelakin-Adewumi avatar Adelakin-Adewumi commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.