# FeDIY FeDIY provides a reproducible Rust development environment using Nix flakes and the fenix toolchain. ## Quick Start ```sh nix develop # or with direnv: direnv allow ``` ### Automatic Environment Setup When you enter the devShell (via `direnv allow` or `nix develop`), the following happens automatically: ✓ **Git Repository**: Initializes `.git` if not present ✓ **Welcome Banner**: Displays available tools and quick commands No manual setup needed! Just start coding. ## Quickstart ```sh nix develop cargo build ``` ## Flatpak Packaging This project supports building Flatpak packages for the FeDIY application. ### Build Flatpak Package 1. Run: ```bash make flatpak-build ``` This will use the manifest at `flatpak/app.flatpak.json` to build a Flatpak bundle in the `build-flatpak/` directory. ### Customize Manifest Edit `flatpak/app.flatpak.json` to update app ID, runtime, build commands, or sources as needed for your project. ### Install/Run Flatpak Locally You can install and run the built Flatpak locally: ```bash flatpak install --user build-flatpak/com.moturpin.fediy.flatpak flatpak run com.moturpin.fediy ``` ## Included Tools | Tool | Purpose | |------|---------| | **cargo** | Rust package manager and build system | | **rustc** | Rust compiler | | **clippy** | Rust linter for catching common mistakes | | **rustfmt** | Rust code formatter | | **rust-analyzer** | Language server for IDE integration | | **rust-src** | Rust source code (for tools like rust-analyzer) | | **cargo-deny** | Audit dependencies for advisories and license policy | | **cargo-edit** | Add/remove/upgrade Cargo dependencies from the CLI | | **cargo-watch** | Auto-rebuild on file changes | | **flatpak-builder** | Build Flatpak distribution packages | | **pre-commit** | Run pre-commit hooks | ## Testing & Development Features Build and testing tools: - **cargo test** - Run unit and integration tests - **cargo clippy** - Lint code for common issues - **cargo fmt** - Format code consistently with rustfmt **Example usage:** ```bash # Run tests cargo test # Check code with clippy cargo clippy # Format code cargo fmt # Watch and rebuild on changes cargo watch -x build # Build a Flatpak make flatpak-build ``` ## Project Layout ``` Cargo.toml Cargo.lock src/ └── main.rs (or lib.rs) Makefile .envrc flake.nix ``` ## Legacy Usage If you do not use flakes, run: ```sh nix-shell ``` ## Project Metadata See project.toml for example metadata. ## Planning Documentation - [Planning docs index](docs/README.md) - [Roadmap](docs/ROADMAP.md) - [Architecture baseline](docs/ARCHITECTURE.md) - [Development workflow (TDD/BDD + GitHub Flow)](docs/WORKFLOW.md) ## Helper Tools - **`nix run .#dev-helper`** - Display tool versions and availability - **`cargo build`** - Build the project - **`cargo check`** - Quick syntax check without building - **`cargo doc --open`** - Generate and view documentation ## Packaging for nixpkgs This project is structured for packaging in nixpkgs: - All sources in `src/` - `flake.nix` provides a devShell and package outputs - Add a `default.nix` or package expression as needed for nixpkgs See [nixpkgs Rust packaging docs](https://nixos.org/manual/nixpkgs/stable/#rust) for more details. ## Customization Edit `flake.nix` to: - Add additional Rust targets via `rustup target add [target]` - Include additional cargo plugins - Add board-specific tools (e.g., stm32cube, nrfjprog)