change from mono-home-manager to full flake multi-system configuration
This commit is contained in:
83
home/embedded.nix
Normal file
83
home/embedded.nix
Normal file
@@ -0,0 +1,83 @@
|
||||
# You should run espup-init once per user to install toolchains.
|
||||
#
|
||||
# For STM32/RP2040, you’ll likely configure chip names in flash-stm.
|
||||
#
|
||||
# Add .cargo/config.toml for probe-rs targets like:
|
||||
# [target.riscv32imac-unknown-none-elf]
|
||||
# runner = "probe-rs run"
|
||||
#
|
||||
# Set up arduino-cli using:
|
||||
# arduino-cli config init
|
||||
# arduino-cli core update-index
|
||||
# arduino-cli core install arduino:avr
|
||||
#
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.homeModules.embedded;
|
||||
in
|
||||
|
||||
lib.mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
# General embedded tools
|
||||
rustup
|
||||
binutils
|
||||
cargo-binutils
|
||||
llvmPackages.bintools
|
||||
openocd
|
||||
dfu-util
|
||||
minicom
|
||||
picocom
|
||||
lldb
|
||||
gcc
|
||||
gdb
|
||||
# qemu # quick emulator
|
||||
# gnumake
|
||||
# pkg-config
|
||||
|
||||
# ARM toolchains
|
||||
gcc-arm-embedded
|
||||
|
||||
# Espressif ESP32
|
||||
espup
|
||||
espflash
|
||||
#espmonitor
|
||||
ldproxy
|
||||
cargo-espflash
|
||||
|
||||
# ST-Link / J-Link / Debug probes
|
||||
probe-rs
|
||||
#jlink
|
||||
|
||||
# Arduino
|
||||
arduino-cli
|
||||
];
|
||||
|
||||
# Optional system envs for toolchains or common paths
|
||||
home.sessionVariables = {
|
||||
ESPUP_INSTALL_PATH = "${config.home.homeDirectory}/.espressif";
|
||||
RUSTUP_HOME = "${config.home.homeDirectory}/.rustup";
|
||||
CARGO_HOME = "${config.home.homeDirectory}/.cargo";
|
||||
};
|
||||
|
||||
# Udev rules for embedded devices (ESP, STLink, J-Link, Arduino)
|
||||
# These must be placed on a NixOS system-wide level; for non-NixOS we print a helper
|
||||
home.activation.printUdevHint = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
echo "📎 Embedded development: Make sure you have correct udev rules installed for USB devices."
|
||||
echo "Examples:"
|
||||
echo " - https://github.com/espressif/esp-idf/blob/master/tools/udev/60-esper-devices.rules"
|
||||
echo " - https://probe.rs/docs/getting-started/installation/#udev-rules"
|
||||
echo " - https://www.arduino.cc/en/guide/linux"
|
||||
echo " - For STLink and J-Link adapters: udev rules are required for non-root flashing."
|
||||
'';
|
||||
|
||||
# Optional: shell aliases to speed up common flows
|
||||
programs.zsh.shellAliases = {
|
||||
espup-init = "espup install";
|
||||
flash-esp = "cargo espflash";
|
||||
monitor-esp = "espmonitor";
|
||||
flash-stm = "cargo flash --chip";
|
||||
embed = "cargo embed";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user