Updates to project details
This commit is contained in:
Generated
+10
-1
@@ -3,5 +3,14 @@
|
|||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sample-rust-app"
|
name = "kt_log"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "sparse+https://git.moturpin.com/api/packages/Matsubaa/cargo/"
|
||||||
|
checksum = "3aefa57718ba65539591b8e6bc6062f9eccc3f0b259828553b01dfb8f343f59f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustHW"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"kt_log",
|
||||||
|
]
|
||||||
|
|||||||
+14
-2
@@ -1,6 +1,18 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sample-rust-app"
|
name = "rustHW"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
kt_log = { version = "0.1.4", registry = "gitea" }
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["staticlib"]
|
||||||
|
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
panic = "abort"
|
||||||
|
lto = true
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
panic = "abort"
|
||||||
|
|||||||
@@ -9,15 +9,18 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ {self, ...}: let
|
outputs =
|
||||||
supportedSystems = [
|
inputs@{ self, ... }:
|
||||||
"x86_64-linux"
|
let
|
||||||
"aarch64-linux"
|
supportedSystems = [
|
||||||
"aarch64-darwin"
|
"x86_64-linux"
|
||||||
];
|
"aarch64-linux"
|
||||||
forEachSupportedSystem = f:
|
"aarch64-darwin"
|
||||||
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
];
|
||||||
system:
|
forEachSupportedSystem =
|
||||||
|
f:
|
||||||
|
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||||
|
system:
|
||||||
f {
|
f {
|
||||||
pkgs = import inputs.nixpkgs {
|
pkgs = import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
@@ -26,126 +29,129 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
|
||||||
in {
|
|
||||||
formatter = forEachSupportedSystem ({pkgs}: pkgs.rustfmt);
|
|
||||||
|
|
||||||
templates = {
|
|
||||||
default = {
|
|
||||||
path = ./.;
|
|
||||||
description = "Rust dev environment using fenix; includes a skeletal Cargo project and packaged helper app";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
overlays.default = _final: prev: {
|
|
||||||
rustToolchain = with inputs.fenix.packages.${prev.stdenv.hostPlatform.system};
|
|
||||||
combine (
|
|
||||||
with stable; [
|
|
||||||
clippy
|
|
||||||
rustc
|
|
||||||
cargo
|
|
||||||
rustfmt
|
|
||||||
rust-src
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
};
|
in
|
||||||
|
{
|
||||||
|
formatter = forEachSupportedSystem ({ pkgs }: pkgs.rustfmt);
|
||||||
|
|
||||||
devShells = forEachSupportedSystem (
|
templates = {
|
||||||
{pkgs}: {
|
default = {
|
||||||
default = pkgs.mkShell {
|
path = ./.;
|
||||||
packages = with pkgs; [
|
description = "Rust dev environment using fenix; includes a skeletal Cargo project and packaged helper app";
|
||||||
rustToolchain
|
};
|
||||||
git
|
};
|
||||||
gnumake
|
|
||||||
alejandra
|
|
||||||
statix
|
|
||||||
deadnix
|
|
||||||
editorconfig-checker
|
|
||||||
openssl
|
|
||||||
pkg-config
|
|
||||||
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
|
|
||||||
pre-commit
|
|
||||||
];
|
|
||||||
|
|
||||||
env = {
|
overlays.default = _final: prev: {
|
||||||
# Required by rust-analyzer
|
rustToolchain =
|
||||||
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
|
with inputs.fenix.packages.${prev.stdenv.hostPlatform.system};
|
||||||
|
combine (
|
||||||
|
with stable;
|
||||||
|
[
|
||||||
|
clippy
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
rustfmt
|
||||||
|
rust-src
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells = forEachSupportedSystem (
|
||||||
|
{ pkgs }: {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [
|
||||||
|
rustToolchain
|
||||||
|
git
|
||||||
|
gnumake
|
||||||
|
alejandra
|
||||||
|
statix
|
||||||
|
deadnix
|
||||||
|
editorconfig-checker
|
||||||
|
openssl
|
||||||
|
pkg-config
|
||||||
|
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
|
||||||
|
pre-commit
|
||||||
|
];
|
||||||
|
|
||||||
|
env = {
|
||||||
|
# Required by rust-analyzer
|
||||||
|
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
|
||||||
|
};
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
# Initialize git repository if not already present
|
||||||
|
if [ ! -d .git ]; then
|
||||||
|
git init
|
||||||
|
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 "[rust-template] 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 "See README.md for usage."
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
packages = forEachSupportedSystem (
|
||||||
|
{ pkgs }: {
|
||||||
|
# Build the skeletal Cargo project
|
||||||
|
default = pkgs.rustPlatform.buildRustPackage {
|
||||||
|
pname = "rustHW";
|
||||||
|
version = "0.1.0";
|
||||||
|
src = ./.;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
shellHook = ''
|
devHelper = pkgs.writeShellScriptBin "dev-helper" ''
|
||||||
# Initialize git repository if not already present
|
echo "Rust toolchain available:"
|
||||||
if [ ! -d .git ]; then
|
command -v cargo >/dev/null 2>&1 && cargo --version || true
|
||||||
git init
|
command -v rustc >/dev/null 2>&1 && rustc --version || true
|
||||||
echo "✓ Initialized git repository"
|
echo "This binary is built by Nix (packages.default)."
|
||||||
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 "[rust-template] 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 "See README.md for usage."
|
|
||||||
'';
|
'';
|
||||||
};
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
|
|
||||||
packages = forEachSupportedSystem (
|
apps = forEachSupportedSystem (
|
||||||
{pkgs}: {
|
{ pkgs }: {
|
||||||
# Build the skeletal Cargo project
|
default = {
|
||||||
default = pkgs.rustPlatform.buildRustPackage {
|
type = "app";
|
||||||
pname = "sample-rust-app";
|
program = pkgs.lib.getExe self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||||
version = "0.1.0";
|
};
|
||||||
src = ./.;
|
dev-helper = {
|
||||||
cargoLock.lockFile = ./Cargo.lock;
|
type = "app";
|
||||||
};
|
program = pkgs.lib.getExe self.packages.${pkgs.stdenv.hostPlatform.system}.devHelper;
|
||||||
|
};
|
||||||
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)."
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
apps = forEachSupportedSystem (
|
|
||||||
{pkgs}: {
|
|
||||||
default = {
|
|
||||||
type = "app";
|
|
||||||
program = pkgs.lib.getExe self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
||||||
};
|
|
||||||
dev-helper = {
|
|
||||||
type = "app";
|
|
||||||
program = pkgs.lib.getExe self.packages.${pkgs.stdenv.hostPlatform.system}.devHelper;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user