diff --git a/.flatpak-builder/ccache/disabled/ccache.conf b/.flatpak-builder/ccache/disabled/ccache.conf new file mode 100644 index 0000000..4d6556c --- /dev/null +++ b/.flatpak-builder/ccache/disabled/ccache.conf @@ -0,0 +1 @@ +disable = true diff --git a/README.md b/README.md index 88eebc8..be2daa1 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,6 @@ direnv allow When you enter the devShell (via `direnv allow` or `nix develop`), the following happens automatically: ✓ **Git Repository**: Initializes `.git` if not present -✓ **Rust Targets**: Automatically adds common embedded Rust targets (ARM Cortex-M, RISC-V) -✓ **Cargo Paths**: Sets up `$HOME/.cargo/bin` in PATH for cargo-installed binaries ✓ **Welcome Banner**: Displays available tools and quick commands No manual setup needed! Just start coding. @@ -24,32 +22,17 @@ No manual setup needed! Just start coding. ## Quickstart ```sh -nix flake init -t path:../flakes#rust nix develop cargo build ``` -## Embedded Rust Support - -The devShell automatically installs common embedded Rust targets via `rustup`: - -| Target | Platform | Use Case | -|--------|----------|----------| -| `thumbv6m-none-eabi` | ARM Cortex-M0/M0+ | RP2040 (Pico) | -| `thumbv7em-none-eabihf` | ARM Cortex-M4F/M7F | STM32, nRF52840 | -| `riscv32imc-unknown-none-elf` | RISC-V 32-bit | ESP32-C3 (basic) | -| `riscv32imac-unknown-none-elf` | RISC-V 32-bit (atomic) | ESP32-C3 (advanced) | - -**Note:** ESP32 Xtensa targets require espup or custom toolchains (see [esp-rs](https://github.com/esp-rs)). - ## Flatpak Packaging This project supports building Flatpak packages for the FeDIY application. ### Build Flatpak Package -1. Ensure you have `flatpak-builder` installed. -2. Run: +1. Run: ```bash make flatpak-build @@ -80,14 +63,11 @@ flatpak run com.moturpin.fediy | **rustfmt** | Rust code formatter | | **rust-analyzer** | Language server for IDE integration | | **rust-src** | Rust source code (for tools like rust-analyzer) | -| **probe-rs** | Embedded debugger/flasher for ARM targets | -| **espflash** | Flashing tool for ESP32 boards | -| **openocd** | JTAG/SWD debugger for ARM and other targets | -| **minicom** | Serial terminal for device output | -| **elf2uf2-rs** | Convert ELF to UF2 format (RP2040) | -| **picotool** | Pico-specific firmware operations | -| **avrdude** | AVR microcontroller programmer | -| **ravedude** | Rapid AVR development utility | +| **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 @@ -109,8 +89,11 @@ cargo clippy # Format code cargo fmt -# Build for embedded target -cargo build --target thumbv7em-none-eabihf --release +# Watch and rebuild on changes +cargo watch -x build + +# Build a Flatpak +make flatpak-build ``` ## Project Layout diff --git a/flake.nix b/flake.nix index be5db2a..3e7c241 100644 --- a/flake.nix +++ b/flake.nix @@ -60,30 +60,22 @@ { default = pkgs.mkShell { packages = with pkgs; [ + # Rust toolchain (managed by fenix overlay) rustToolchain + rust-analyzer + # Build essentials git gnumake openssl pkg-config + # Cargo productivity tools cargo-deny cargo-edit cargo-watch - cargo-generate - rust-analyzer - rustup - # Embedded Rust tooling - probe-rs-tools - espflash - openocd - minicom - # RP2040 UF2 workflows - elf2uf2-rs - picotool - avrdude - pkgsCross.avr.buildPackages.libc - pkgsCross.avr.buildPackages.gcc - ravedude + # Code quality pre-commit + # Packaging + flatpak-builder ]; env = { @@ -98,20 +90,9 @@ echo "✓ Initialized git repository" fi - # Ensure user's Cargo-installed binaries are available - export PATH="$HOME/.cargo/bin:$PATH" - - if command -v rustup >/dev/null 2>&1; then - echo "Ensuring common embedded Rust targets are available (idempotent)..." - rustup target add thumbv6m-none-eabi >/dev/null 2>&1 || true # Cortex-M0/M0+ (RP2040) - rustup target add thumbv7em-none-eabihf >/dev/null 2>&1 || true # Cortex-M4F/M7F (many STM32/nRF52) - rustup target add riscv32imc-unknown-none-elf >/dev/null 2>&1 || true - rustup target add riscv32imac-unknown-none-elf >/dev/null 2>&1 || true # ESP32-C3 class - echo "Note: ESP32 Xtensa targets require espup/custom toolchains (see esp-rs)." - fi - echo "[FeDIY] Welcome to the Rust dev shell!" - echo "Tools: cargo, rustc, clippy, rustfmt, rust-analyzer, probe-rs, espflash, openocd, minicom, elf2uf2-rs, picotool, avrdude, ravedude" - echo "Run 'cargo build' to build, or 'nix run .#dev-helper' for a tool summary." + echo "[FeDIY] Welcome to the dev shell!" + echo "Tools: cargo, rustc, clippy, rustfmt, rust-analyzer, flatpak-builder" + echo "Run 'cargo build' to build, 'make flatpak-build' for Flatpak, or 'nix run .#dev-helper' for a tool summary." echo "See README.md for usage." ''; }; @@ -130,10 +111,12 @@ }; devHelper = pkgs.writeShellScriptBin "dev-helper" '' - echo "Rust toolchain available:" - command -v cargo >/dev/null 2>&1 && cargo --version || true - command -v rustc >/dev/null 2>&1 && rustc --version || true - echo "This binary is built by Nix (packages.default)." + echo "=== FeDIY dev shell tools ===" + command -v cargo >/dev/null 2>&1 && echo "cargo: $(cargo --version)" || echo "cargo: not found" + command -v rustc >/dev/null 2>&1 && echo "rustc: $(rustc --version)" || echo "rustc: not found" + command -v rust-analyzer >/dev/null 2>&1 && echo "rust-analyzer: $(rust-analyzer --version)" || echo "rust-analyzer: not found" + command -v flatpak-builder >/dev/null 2>&1 && echo "flatpak-builder: $(flatpak-builder --version)" || echo "flatpak-builder: not found" + command -v pre-commit >/dev/null 2>&1 && echo "pre-commit: $(pre-commit --version)" || echo "pre-commit: not found" ''; } );