# Rust + Bevy Development Environment A reproducible Rust development environment for building applications and games with **Bevy**. This flake provides a complete toolchain, common native dependencies for Bevy on Linux, and a preconfigured development shell. ## Features * Latest stable Rust toolchain via **Fenix** * **rust-analyzer** for editor integration * **Crane** for reproducible package builds * **Clang + Mold** for significantly faster linking * Vulkan, Wayland, X11, ALSA, and udev libraries required by most Bevy projects * Ready to use with `nix develop` ## Included Software ### Rust Toolchain * Stable Rust * Cargo * Rustfmt * Clippy * rust-analyzer ### Build Tools * Clang * Mold linker * pkg-config ### Native Libraries * Vulkan Loader * Wayland * libxkbcommon * X11 * Xcursor * Xi * Xrandr * ALSA * udev These libraries cover the requirements for most Bevy applications without additional setup. ## Usage Enter the development environment: ```bash nix develop ``` Build the project: ```bash cargo build ``` Run the project: ```bash cargo run ``` Run with release optimizations: ```bash cargo run --release ``` ## Building with Nix Build the project as a Nix package: ```bash nix build ``` Run the packaged application: ```bash nix run ``` The flake uses **Crane** to build your crate in a reproducible manner. ## Linker Configuration The development environment uses: * **Clang** as the linker driver * **Mold** as the linker This is configured automatically through: ```text CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=clang RUSTFLAGS="-C link-arg=-fuse-ld=mold" ``` Using Mold can dramatically reduce link times, which is especially useful during game development. ## Editor Support The included `rust-analyzer` integrates automatically with editors such as: * Neovim * Helix * VS Code * Zed * Emacs No additional Rust installation is required. ## Project Layout This template assumes a standard Cargo project: ```text . ├── Cargo.toml ├── Cargo.lock ├── flake.nix └── src/ └── main.rs ``` ## Customization Depending on your project, you may wish to extend the development shell with additional tools such as: * `trunk` for WebAssembly targets * `lldb` or `gdb` for debugging * `cargo-nextest` * `cargo-watch` * `cargo-deny` * `cargo-flamegraph` Additional system libraries can also be added to `buildInputs` if your project depends on them. ## Notes This template is primarily intended for Linux Bevy development. It includes the native dependencies commonly required for windowing, graphics, input, and audio. Basic Darwin support is included where applicable, but additional configuration may be necessary for macOS-specific projects.