docs: add usage instructions

This commit is contained in:
raf 2024-04-13 05:16:28 +03:00
parent da46624c32
commit ab9be9a506
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29

View file

@ -4,30 +4,49 @@
## Available Utilities ## Available Utilities
### nixfetch (WIP) ### nixfetch [0.1.0]
nixfetch fetches a file, adds it to the nix store and returns JSON data for the newly nixfetch fetches a file, adds it to the nix store and returns JSON data for the newly
added path: mainly the file path and the hash. It is ultimately a wrapper around added path: mainly the file path and the hash. It is ultimately a wrapper around
`nix store prefetch-file`. The nix store is used to avoid storing duplicates `nix store prefetch-file`. The nix store is used to avoid storing duplicates
of the same file. of the same file.
#### Usage
```bash
$ nixfetch https://raw.githubusercontent.com/NotAShelf/nutils/main/LICENSE # e.g.: try to fetch a path from Github
{"hash":"sha256-OXLcl0T2SZ8Pmy2/dmlvKuetivmyPd5m1q+Gyd+zaYY=","storePath":"/nix/store/zgw1a0w4j9anca8kjmgizy1m5zc9c0k2-LICENSE"}
```
### flakecheck [0.1.0] (WIP)
flakecheck runs `nix flake check` with the `--no-build` argument and monitors the
output for file errors containing the message `is not valid`. If a broken path is
found, then attempts to repair the given path with `nix-store --repair-path`.
This is not a magic bullet. You should be concerned if your store produces broken
paths, and investigate carefully.
## Building ## Building
You know how to use Rust, yes? You know how to use Rust, yes?
Build the workspace you'd like to use. Nix package is a TODO because I don't really
know how to build a multi-workspace project with Nix.
## Contributing ## Contributing
Do you know how to use Rust? I don't. Make a pull request if you find one of my many mistakes. You may unlock the Do you know how to use Rust? I don't. Make a pull request if you find one of my many mistakes. You may unlock the
golden shelf skin at 99 mistakes found. golden shelf skin at 99 mistakes found.
The repository follows a very simple structure: each utility must be its own workspace, and common functions The repository follows a very simple structure: each utility must be its own workspace. If you find yourself
should go under the `commons` workspace. repeating code, start abstracting or add a `commons` workspace.
### Adding new utilities ### Adding new utilities
This is a monorepo for utility wrappers around the nix package manager, focusing on the package manager itself This is a monorepo for utility wrappers around the nix package manager, focusing on the package manager itself
rather than `nixos-rebuild` unlike the awesome [nh](https://github.com/viperml/nh) project. If you wish to add rather than `nixos-rebuild` unlike the awesome [nh](https://github.com/viperml/nh) project. If you wish to add
an utility, feel free to. an utility, feel free to. Format your code with `rustfmt`, leave proper comments.
## License ## License