From bfe0d82e6e6e6e87be80da773335c9056ba4e014 Mon Sep 17 00:00:00 2001 From: Kyle J Turpin Date: Thu, 20 Aug 2026 18:18:00 -0500 Subject: [PATCH] Switch .direnv flake profile link to flake-profile-2 --- .gitea/workflows/build.yml | 23 ++++++ .gitea/workflows/test.yml | 23 ++++++ README.md | 165 ++----------------------------------- 3 files changed, 52 insertions(+), 159 deletions(-) create mode 100644 .gitea/workflows/build.yml create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..db53bd3 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,23 @@ +# .gitea/workflows/build.yml +name: cargo build + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Build crate + run: cargo build --verbose \ No newline at end of file diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..3c6bd68 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,23 @@ +# .gitea/workflows/test.yml +name: cargo test + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Run tests + run: cargo test --verbose \ No newline at end of file diff --git a/README.md b/README.md index 19a5f90..29fb1a6 100644 --- a/README.md +++ b/README.md @@ -1,163 +1,10 @@ -# Rust Nix Flake Template +# kt_log -This template provides a reproducible Rust development environment using Nix flakes and the fenix toolchain. +[![cargo build](https://git.moturpin.com/Matsubaa/kt_log/actions/workflows/build.yml/badge.svg)](https://git.moturpin.com/Matsubaa/kt_log/actions/workflows/build.yml) +[![cargo test](https://git.moturpin.com/Matsubaa/kt_log/actions/workflows/test.yml/badge.svg)](https://git.moturpin.com/Matsubaa/kt_log/actions/workflows/test.yml) -## Quick Start +A console logging library for Rust applications. -```sh -nix develop -# or with direnv: -direnv allow -``` +## Installation -### 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 -✓ **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. - -## 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 template supports building Flatpak packages for your Rust application. - -### Build Flatpak Package - -1. Ensure you have `flatpak-builder` installed. -2. 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/org.example.rustdevshell.flatpak -flatpak run org.example.rustdevshell -``` - -## 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) | -| **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 | - -## 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 - -# Build for embedded target -cargo build --target thumbv7em-none-eabihf --release -``` - -## 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. - -## 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 template is structured for easy packaging in nixpkgs: - -- All sources in `src/` -- `flake.nix` provides a devShell and template -- 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) +This crate is published to the `gitea` Cargo registry.