diff --git a/overlays.nix b/overlays.nix index 24da28f..e29673f 100644 --- a/overlays.nix +++ b/overlays.nix @@ -1,6 +1,9 @@ flake_input@{ kpcli-py, nixgl, rust-overlay, ... }: [ + nixgl.overlays.default + rust-overlay.overlays.default + (final: prev: { # use python3.9, which works because of cython somehow? kpcli-py = final.poetry2nix.mkPoetryApplication { @@ -16,5 +19,6 @@ flake_input@{ kpcli-py, nixgl, rust-overlay, ... }: [ }); }; }) + ] diff --git a/templates/rust-monorepo/.gitignore b/templates/rust-monorepo/.gitignore index 4a45e6e..ca401be 100644 --- a/templates/rust-monorepo/.gitignore +++ b/templates/rust-monorepo/.gitignore @@ -3,10 +3,6 @@ debug/ 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 **/*.rs.bk diff --git a/templates/rust-monorepo/README.md b/templates/rust-monorepo/README.md new file mode 100644 index 0000000..22b176a --- /dev/null +++ b/templates/rust-monorepo/README.md @@ -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 + + diff --git a/templates/rust-monorepo/flake.nix b/templates/rust-monorepo/flake.nix index f352b18..a75001f 100644 --- a/templates/rust-monorepo/flake.nix +++ b/templates/rust-monorepo/flake.nix @@ -25,6 +25,13 @@ devShell = with pkgs; mkShell { buildInputs = [ 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 = '' # nix flake update # is this even needed?