readme to rust-monorepo

pull/5/head
pegasust 2023-01-06 11:07:05 -07:00
parent bd62ef48c2
commit 98da9eec26
4 changed files with 52 additions and 4 deletions

View File

@ -1,6 +1,9 @@
flake_input@{ kpcli-py, nixgl, rust-overlay, ... }: [ flake_input@{ kpcli-py, nixgl, rust-overlay, ... }: [
nixgl.overlays.default nixgl.overlays.default
rust-overlay.overlays.default rust-overlay.overlays.default
(final: prev: { (final: prev: {
# use python3.9, which works because of cython somehow? # use python3.9, which works because of cython somehow?
kpcli-py = final.poetry2nix.mkPoetryApplication { kpcli-py = final.poetry2nix.mkPoetryApplication {
@ -16,5 +19,6 @@ flake_input@{ kpcli-py, nixgl, rust-overlay, ... }: [
}); });
}; };
}) })
] ]

View File

@ -3,10 +3,6 @@
debug/ debug/
target/ target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt # These are backup files generated by rustfmt
**/*.rs.bk **/*.rs.bk

View File

@ -0,0 +1,41 @@
# Rust-monorepo. TODO: Change this to your monorepo name
## About this template
[![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org)
- Bootstrapped with [pegasust/dotfiles](https://git.pegasust.com/pegasust/dotfiles)
- Uses [naersk](https://github.com/nix-community/naersk.git) to build package(s)
- Provides [devShell (`nix develop`)](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html),
[shell.nix (`nix-shell -p ./`)](https://nixos.org/manual/nix/stable/command-ref/nix-shell.html)
for development environment. It contains:
- The default `devShell` provides Nightly rustc via
[`gh:oxalica/rust-overlay`](https://github.com/oxalica/rust-overlay.git)
- [rustc components](https://rust-lang.github.io/rustup/concepts/components.html) includes
`rust-src`, [`rust-analyzer`](https://github.com/rust-lang/rust-analyzer.git),
`clippy`, `miri`
- [`evcxr`: Rust REPL]() and [`bacon`: Rust nodemon]()
## Check out these [killer libraries](https://jondot.medium.com/12-killer-rust-libraries-you-should-know-c60bab07624f)
### Application development
- [Serde](https://github.com/serde-rs/serde) for (de)serialization needs
- Data-driven programming in Rust starts with Serde
- Service system programming starts with defining your message protocols & data formats
- [Clap](https://docs.rs/clap/latest/clap/) declarative CLI arguments
- Data-driven CLI development in Rust starts with Clap
- [itertools](https://lib.rs/crates/itertools) for extra juice to iterators
- [log](https://lib.rs/crates/log) or [env-logger](https://docs.rs/env_logger/latest/env_logger)
for logging needs
### Library development
- [proptest](https://lib.rs/crates/proptest) for hyppothesis testing
- Data-driven testing starts with proptest

View File

@ -25,6 +25,13 @@
devShell = with pkgs; mkShell { devShell = with pkgs; mkShell {
buildInputs = [ buildInputs = [
rust_pkgs rust_pkgs
# rust's compiler is quite powerful enough to the point where
# a REPL is not really necessary.
# Rely on the compiler and bacon 99% of the time
# only use REPL if you need to explore/prototype
# In that case, might as well put the code into sandbox
pkgs.evcxr
pkgs.bacon
]; ];
shellHook = '' shellHook = ''
# nix flake update # is this even needed? # nix flake update # is this even needed?