Compare commits
10 Commits
0c581ed8b0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
60448993c5
|
|||
|
0d1a37eef3
|
|||
|
ba2dce4b85
|
|||
|
d40b80a910
|
|||
|
7a05bf3d5e
|
|||
|
81008113e3
|
|||
|
bc7f84a854
|
|||
|
c95a397e58
|
|||
|
e6289d758b
|
|||
|
d00885ced7
|
@@ -0,0 +1,8 @@
|
|||||||
|
[global]
|
||||||
|
disable = [
|
||||||
|
# line length limits
|
||||||
|
"MD013",
|
||||||
|
]
|
||||||
|
|
||||||
|
[MD057]
|
||||||
|
absolute-links = "relative_to_roots"
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
# project-templates
|
# project-templates
|
||||||
|
|
||||||
Nix flake templates for initializing new projects.
|
Nix flake templates for initializing new projects.
|
||||||
|
|||||||
+2
-2
@@ -155,8 +155,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Formatter for nix files, available through 'nix fmt'
|
# Formatter for nix files, available through 'nix fmt'
|
||||||
treefmt = lib.mkIf cfg.formatter.enable {
|
treefmt.programs = lib.mkIf cfg.formatter.enable {
|
||||||
programs.alejandra.enable = lib.mkIf cfg.formatter.nix true;
|
alejandra.enable = lib.mkIf cfg.formatter.nix true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -34,7 +34,9 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./cad
|
./cad
|
||||||
./rust
|
./rust
|
||||||
|
./rust-esp32-c6
|
||||||
|
|
||||||
|
inputs.treefmt-nix.flakeModule
|
||||||
flake-parts.flakeModules.flakeModules
|
flake-parts.flakeModules.flakeModules
|
||||||
# define the flake.templates option
|
# define the flake.templates option
|
||||||
({lib, ...}: {
|
({lib, ...}: {
|
||||||
@@ -56,6 +58,13 @@
|
|||||||
|
|
||||||
systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin"];
|
systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin"];
|
||||||
|
|
||||||
perSystem = {pkgs, ...}: {formatter = pkgs.alejandra;};
|
perSystem = {pkgs, ...}: {
|
||||||
|
treefmt.programs = {
|
||||||
|
alejandra.enable = true; # nix
|
||||||
|
taplo.enable = true; # toml
|
||||||
|
rumdl-check.enable = true; # markdown
|
||||||
|
rumdl-format.enable = true; # markdown
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
flake-parts-lib,
|
||||||
|
inputs,
|
||||||
|
self,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
flake = {
|
||||||
|
templates = {
|
||||||
|
rust-esp32-c6 = {
|
||||||
|
path = ./template;
|
||||||
|
description = "ESP32-C6 RISC-V rust project with a blink led example";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flakeModules.rust-esp32-c6 = {
|
||||||
|
imports = [
|
||||||
|
inputs.treefmt-nix.flakeModule
|
||||||
|
self.outputs.flakeModules.rust
|
||||||
|
];
|
||||||
|
|
||||||
|
options.perSystem = flake-parts-lib.mkPerSystemOption ({
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
self',
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.krantz.rust.esp32-c6;
|
||||||
|
|
||||||
|
craneLib = config.krantz.rust.craneLib;
|
||||||
|
in {
|
||||||
|
options.krantz.rust.esp32-c6 = {
|
||||||
|
enable = lib.mkEnableOption "additional tooling for the esp32 RISC-V";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
krantz.rust.devDeps = lib.mkOptionDefault (with pkgs; [
|
||||||
|
espflash
|
||||||
|
]);
|
||||||
|
|
||||||
|
krantz.rust.cargoArtifacts.extraAttrs = lib.mkOptionDefault {
|
||||||
|
doCheck = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
krantz.rust.package.extraAttrs = lib.mkOptionDefault {
|
||||||
|
doCheck = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
[target.riscv32imac-unknown-none-elf]
|
||||||
|
runner = "espflash flash --monitor --chip esp32c6 --log-format defmt"
|
||||||
|
|
||||||
|
[env]
|
||||||
|
DEFMT_LOG = "info"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
rustflags = [
|
||||||
|
# Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.)
|
||||||
|
# NOTE: May negatively impact performance of produced code
|
||||||
|
"-C",
|
||||||
|
"force-frame-pointers",
|
||||||
|
]
|
||||||
|
|
||||||
|
target = "riscv32imac-unknown-none-elf"
|
||||||
|
|
||||||
|
[unstable]
|
||||||
|
build-std = ["alloc", "core"]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
stack-size-threshold = 1024
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
use flake
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
name: "Flake.lock: update Nix dependencies for development environment only"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # allows manual triggering
|
||||||
|
schedule:
|
||||||
|
- cron: '00 00 02 1/2 *' # runs the first of day the month every 2 months at 7:00pm local time (midnight UTC)
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
nix-flake-update:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: "install nix"
|
||||||
|
uses: cachix/install-nix-action@v31
|
||||||
|
|
||||||
|
- name: "setup git user"
|
||||||
|
uses: fregante/setup-git-user@v2
|
||||||
|
|
||||||
|
- name: "update flake.lock"
|
||||||
|
run: |
|
||||||
|
nix flake update --commit-lock-file
|
||||||
|
|
||||||
|
- name: "check flake for errors"
|
||||||
|
run: |
|
||||||
|
nix flake check
|
||||||
|
|
||||||
|
- name: "push update"
|
||||||
|
run: |
|
||||||
|
git push
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by nix
|
||||||
|
.direnv/
|
||||||
|
result
|
||||||
|
|
||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
debug/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Editor configuration
|
||||||
|
.vscode/
|
||||||
|
.zed/
|
||||||
|
.helix/
|
||||||
|
.nvim.lua
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# Ignore .DS_Store file in mac
|
||||||
|
**/.DS_Store
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[global]
|
||||||
|
disable = [
|
||||||
|
# line length limits
|
||||||
|
"MD013",
|
||||||
|
]
|
||||||
|
|
||||||
|
[MD057]
|
||||||
|
absolute-links = "relative_to_roots"
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
[package]
|
||||||
|
edition = "2024"
|
||||||
|
name = "rust-esp32-c6"
|
||||||
|
rust-version = "1.88"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "rust-esp32-c6"
|
||||||
|
path = "./src/bin/main.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
esp-hal = { version = "~1.1.0", features = ["defmt", "esp32c6", "unstable"] }
|
||||||
|
|
||||||
|
esp-rtos = { version = "0.3.0", features = [
|
||||||
|
"defmt",
|
||||||
|
"embassy",
|
||||||
|
"esp-alloc",
|
||||||
|
"esp32c6",
|
||||||
|
] }
|
||||||
|
|
||||||
|
defmt = "1.0.1"
|
||||||
|
esp-bootloader-esp-idf = { version = "0.5.0", features = ["defmt", "esp32c6"] }
|
||||||
|
|
||||||
|
embassy-executor = { version = "0.10.0", features = ["defmt"] }
|
||||||
|
embassy-time = { version = "0.5.0", features = ["defmt"] }
|
||||||
|
esp-alloc = { version = "0.10.0", features = ["defmt"] }
|
||||||
|
esp-backtrace = { version = "0.19.0", features = [
|
||||||
|
"defmt",
|
||||||
|
"esp32c6",
|
||||||
|
"panic-handler",
|
||||||
|
] }
|
||||||
|
esp-println = { version = "0.17.0", features = ["defmt-espflash", "esp32c6"] }
|
||||||
|
|
||||||
|
critical-section = "1.2.0"
|
||||||
|
static_cell = "2.1.1"
|
||||||
|
|
||||||
|
|
||||||
|
# For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html
|
||||||
|
[profile.dev]
|
||||||
|
# The default debug profile is too slow and too big for resource-constrained devices.
|
||||||
|
# Always build with some optimizations enabled.
|
||||||
|
opt-level = "s"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
codegen-units = 1 # LLVM can perform better optimizations using a single thread
|
||||||
|
debug = 2 # prefer slower builds but better debugging experience
|
||||||
|
lto = 'fat'
|
||||||
|
opt-level = 's'
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
fn main() {
|
||||||
|
linker_be_nice();
|
||||||
|
println!("cargo:rustc-link-arg=-Tdefmt.x");
|
||||||
|
// make sure linkall.x is the last linker script (otherwise might cause problems with flip-link)
|
||||||
|
println!("cargo:rustc-link-arg=-Tlinkall.x");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn linker_be_nice() {
|
||||||
|
let args: Vec<String> = std::env::args().collect();
|
||||||
|
if args.len() > 1 {
|
||||||
|
let kind = &args[1];
|
||||||
|
let what = &args[2];
|
||||||
|
|
||||||
|
match kind.as_str() {
|
||||||
|
"undefined-symbol" => match what.as_str() {
|
||||||
|
what if what.starts_with("_defmt_") => {
|
||||||
|
eprintln!();
|
||||||
|
eprintln!(
|
||||||
|
"💡 `defmt` not found - make sure `defmt.x` is added as a linker script and you have included `use defmt_rtt as _;`"
|
||||||
|
);
|
||||||
|
eprintln!();
|
||||||
|
}
|
||||||
|
"_stack_start" => {
|
||||||
|
eprintln!();
|
||||||
|
eprintln!("💡 Is the linker script `linkall.x` missing?");
|
||||||
|
eprintln!();
|
||||||
|
}
|
||||||
|
what if what.starts_with("esp_rtos_") => {
|
||||||
|
eprintln!();
|
||||||
|
eprintln!(
|
||||||
|
"💡 `esp-radio` has no scheduler enabled. Make sure you have initialized `esp-rtos` or provided an external scheduler."
|
||||||
|
);
|
||||||
|
eprintln!();
|
||||||
|
}
|
||||||
|
"embedded_test_linker_file_not_added_to_rustflags" => {
|
||||||
|
eprintln!();
|
||||||
|
eprintln!(
|
||||||
|
"💡 `embedded-test` not found - make sure `embedded-test.x` is added as a linker script for tests"
|
||||||
|
);
|
||||||
|
eprintln!();
|
||||||
|
}
|
||||||
|
"free"
|
||||||
|
| "malloc"
|
||||||
|
| "calloc"
|
||||||
|
| "get_free_internal_heap_size"
|
||||||
|
| "malloc_internal"
|
||||||
|
| "realloc_internal"
|
||||||
|
| "calloc_internal"
|
||||||
|
| "free_internal" => {
|
||||||
|
eprintln!();
|
||||||
|
eprintln!(
|
||||||
|
"💡 Did you forget the `esp-alloc` dependency or didn't enable the `compat` feature on it?"
|
||||||
|
);
|
||||||
|
eprintln!();
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
},
|
||||||
|
// we don't have anything helpful for "missing-lib" yet
|
||||||
|
_ => {
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::process::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"cargo:rustc-link-arg=--error-handling-script={}",
|
||||||
|
std::env::current_exe().unwrap().display()
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
description = "esp32 tool";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
|
||||||
|
project-templates = {
|
||||||
|
url = "git+https://git.krantz.one/reed/project-templates";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.flake-parts.follows = "flake-parts";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
flake-parts,
|
||||||
|
project-templates,
|
||||||
|
...
|
||||||
|
} @ inputs:
|
||||||
|
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||||
|
imports = [
|
||||||
|
project-templates.flakeModules.rust-esp32-c6
|
||||||
|
];
|
||||||
|
|
||||||
|
systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin"];
|
||||||
|
|
||||||
|
perSystem = {pkgs, ...}: {
|
||||||
|
krantz.rust = {
|
||||||
|
esp32-c6 = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
enable = true;
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
# runtimeDeps = with pkgs; [];
|
||||||
|
# buildDeps = with pkgs; [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[toolchain]
|
||||||
|
channel = "stable"
|
||||||
|
components = ["rust-src"]
|
||||||
|
targets = ["riscv32imac-unknown-none-elf"]
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
#![deny(
|
||||||
|
clippy::mem_forget,
|
||||||
|
reason = "mem::forget is generally not safe to do with esp_hal types, especially those \
|
||||||
|
holding buffers for the duration of a data transfer."
|
||||||
|
)]
|
||||||
|
#![deny(clippy::large_stack_frames)]
|
||||||
|
|
||||||
|
use defmt::info;
|
||||||
|
use embassy_executor::Spawner;
|
||||||
|
use embassy_time::{Duration, Timer};
|
||||||
|
use esp_backtrace as _;
|
||||||
|
use esp_hal::clock::CpuClock;
|
||||||
|
use esp_hal::timer::timg::TimerGroup;
|
||||||
|
use esp_println as _;
|
||||||
|
|
||||||
|
extern crate alloc;
|
||||||
|
|
||||||
|
// This creates a default app-descriptor required by the esp-idf bootloader.
|
||||||
|
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
||||||
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
|
|
||||||
|
#[allow(
|
||||||
|
clippy::large_stack_frames,
|
||||||
|
reason = "it's not unusual to allocate larger buffers etc. in main"
|
||||||
|
)]
|
||||||
|
#[esp_rtos::main]
|
||||||
|
async fn main(spawner: Spawner) -> ! {
|
||||||
|
// generator version: 1.3.0
|
||||||
|
// generator parameters: --chip esp32c6 -o alloc -o unstable-hal -o esp-backtrace -o embassy -o defmt
|
||||||
|
|
||||||
|
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||||
|
let peripherals = esp_hal::init(config);
|
||||||
|
|
||||||
|
esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 65536);
|
||||||
|
|
||||||
|
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||||
|
let sw_interrupt =
|
||||||
|
esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
|
||||||
|
esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0);
|
||||||
|
|
||||||
|
info!("Embassy initialized!");
|
||||||
|
|
||||||
|
// TODO: Spawn some tasks
|
||||||
|
let _ = spawner;
|
||||||
|
|
||||||
|
loop {
|
||||||
|
info!("Hello world!");
|
||||||
|
Timer::after(Duration::from_secs(1)).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.1.0/examples
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#![no_std]
|
||||||
+42
-14
@@ -29,7 +29,7 @@
|
|||||||
manifest = (lib.importTOML "${src}/Cargo.toml").package;
|
manifest = (lib.importTOML "${src}/Cargo.toml").package;
|
||||||
|
|
||||||
craneLib =
|
craneLib =
|
||||||
if builtins.pathExists cfg.srcToolchain
|
if cfg.srcToolchain != null && builtins.pathExists cfg.srcToolchain
|
||||||
then
|
then
|
||||||
(inputs.crane.mkLib (pkgs.extend inputs.rust-overlay.overlays.default)).overrideToolchain (
|
(inputs.crane.mkLib (pkgs.extend inputs.rust-overlay.overlays.default)).overrideToolchain (
|
||||||
p: p.rust-bin.fromRustupToolchainFile cfg.srcToolchain
|
p: p.rust-bin.fromRustupToolchainFile cfg.srcToolchain
|
||||||
@@ -43,9 +43,10 @@
|
|||||||
|
|
||||||
# Build *just* the cargo dependencies, so we can reuse
|
# Build *just* the cargo dependencies, so we can reuse
|
||||||
# all of that work (e.g. via cachix) when running in CI
|
# all of that work (e.g. via cachix) when running in CI
|
||||||
cargoArtifacts = craneLib.buildDepsOnly {
|
cargoArtifacts = craneLib.buildDepsOnly ({
|
||||||
inherit src buildInputs nativeBuildInputs;
|
inherit src buildInputs nativeBuildInputs;
|
||||||
};
|
}
|
||||||
|
// cfg.cargoArtifacts.extraAttrs);
|
||||||
in {
|
in {
|
||||||
options.krantz.rust = {
|
options.krantz.rust = {
|
||||||
enable = lib.mkEnableOption "building a cargo project with crane";
|
enable = lib.mkEnableOption "building a cargo project with crane";
|
||||||
@@ -60,14 +61,26 @@
|
|||||||
description = "A path to the filtered directory of the root of the crate.";
|
description = "A path to the filtered directory of the root of the crate.";
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
default = craneLib.cleanCargoSource cfg.src;
|
default = craneLib.cleanCargoSource cfg.src;
|
||||||
defaultText = lib.literalExpression "config.krantz.rust.craneLib cfg.src";
|
defaultText = lib.literalExpression "config.krantz.rust.craneLib.cleanCargoSource cfg.src";
|
||||||
example = lib.literalExpression "./.";
|
example = lib.literalExpression "./.";
|
||||||
};
|
};
|
||||||
srcToolchain = lib.mkOption {
|
srcToolchain = lib.mkOption {
|
||||||
description = "A path to the rust-toolchain(.toml) file for the repo. Will use the toolchain from nixpkgs if the file does not exist.";
|
description = "A path to the rust-toolchain(.toml) file for the repo. Will use the toolchain from nixpkgs if the file does not exist.";
|
||||||
type = lib.types.path;
|
type = lib.types.nullOr lib.types.path;
|
||||||
default = "${if cfg.src != null then cfg.src else "/dev/null"}/rust-toolchain.toml";
|
default =
|
||||||
defaultText = lib.literalExpression "cfg.src + \"/rust-toolchain.toml\"";
|
if cfg.src != null
|
||||||
|
then cfg.src + "/rust-toolchain.toml"
|
||||||
|
else null;
|
||||||
|
defaultText =
|
||||||
|
lib.literalExpression
|
||||||
|
/*
|
||||||
|
nix
|
||||||
|
*/
|
||||||
|
''
|
||||||
|
if cfg.src != null
|
||||||
|
then cfg.src + "/rust-toolchain.toml"
|
||||||
|
else null;
|
||||||
|
'';
|
||||||
example = lib.literalExpression "./rust-toolchain";
|
example = lib.literalExpression "./rust-toolchain";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -96,6 +109,17 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cargoArtifacts = {
|
||||||
|
extraAttrs = lib.mkOption {
|
||||||
|
description = "Extra attributes to merge into buildDepsOnly. See https://crane.dev/API.html#cranelibbuilddepsonly";
|
||||||
|
type = lib.types.attrs;
|
||||||
|
default = {};
|
||||||
|
example = {
|
||||||
|
doCheck = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
devShell = {
|
devShell = {
|
||||||
enable = lib.mkEnableOption "a rust development environment" // {default = true;};
|
enable = lib.mkEnableOption "a rust development environment" // {default = true;};
|
||||||
|
|
||||||
@@ -143,6 +167,8 @@
|
|||||||
|
|
||||||
nix = lib.mkEnableOption "formatting for nix files" // {default = true;};
|
nix = lib.mkEnableOption "formatting for nix files" // {default = true;};
|
||||||
rust = lib.mkEnableOption "formatting for rust files" // {default = true;};
|
rust = lib.mkEnableOption "formatting for rust files" // {default = true;};
|
||||||
|
toml = lib.mkEnableOption "formatting for toml files" // {default = true;};
|
||||||
|
markdown = lib.mkEnableOption "formatting for toml files" // {default = true;};
|
||||||
};
|
};
|
||||||
|
|
||||||
checks = {
|
checks = {
|
||||||
@@ -179,20 +205,22 @@
|
|||||||
# Your custom packages
|
# Your custom packages
|
||||||
# Accessible through 'nix build', 'nix shell', 'nix run', etc
|
# Accessible through 'nix build', 'nix shell', 'nix run', etc
|
||||||
packages = lib.mkIf cfg.package.enable {
|
packages = lib.mkIf cfg.package.enable {
|
||||||
${cfg.package.name} =
|
${cfg.package.name} = craneLib.buildPackage ({
|
||||||
craneLib.buildPackage {
|
|
||||||
inherit src buildInputs nativeBuildInputs cargoArtifacts;
|
inherit src buildInputs nativeBuildInputs cargoArtifacts;
|
||||||
}
|
}
|
||||||
// cfg.package.extraAttrs;
|
// cfg.package.extraAttrs);
|
||||||
};
|
};
|
||||||
|
|
||||||
# Formatter for nix files, available through 'nix fmt'
|
# Formatter for nix files, available through 'nix fmt'
|
||||||
treefmt = lib.mkIf cfg.formatter.enable {
|
treefmt.programs = lib.mkIf cfg.formatter.enable {
|
||||||
programs.alejandra.enable = lib.mkIf cfg.formatter.nix true;
|
alejandra.enable = lib.mkIf cfg.formatter.nix true;
|
||||||
programs.rustfmt = lib.mkIf cfg.formatter.rust {
|
rustfmt = lib.mkIf cfg.formatter.rust {
|
||||||
enable = true;
|
enable = true;
|
||||||
edition = manifest.edition;
|
edition = manifest.edition;
|
||||||
};
|
};
|
||||||
|
taplo.enable = lib.mkIf cfg.formatter.toml true;
|
||||||
|
rumdl-check.enable = lib.mkIf cfg.formatter.markdown true;
|
||||||
|
rumdl-format.enable = lib.mkIf cfg.formatter.markdown true;
|
||||||
};
|
};
|
||||||
|
|
||||||
checks = lib.mkIf cfg.checks.enable {
|
checks = lib.mkIf cfg.checks.enable {
|
||||||
|
|||||||
@@ -7,5 +7,17 @@ result
|
|||||||
debug/
|
debug/
|
||||||
target/
|
target/
|
||||||
|
|
||||||
|
# Editor configuration
|
||||||
|
.vscode/
|
||||||
|
.zed/
|
||||||
|
.helix/
|
||||||
|
.nvim.lua
|
||||||
|
|
||||||
# These are backup files generated by rustfmt
|
# These are backup files generated by rustfmt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# Ignore .DS_Store file in mac
|
||||||
|
**/.DS_Store
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[global]
|
||||||
|
disable = [
|
||||||
|
# line length limits
|
||||||
|
"MD013",
|
||||||
|
]
|
||||||
|
|
||||||
|
[MD057]
|
||||||
|
absolute-links = "relative_to_roots"
|
||||||
@@ -15,4 +15,3 @@ tracing-subscriber = "*"
|
|||||||
|
|
||||||
clap = { version = "*", features = ["derive"] }
|
clap = { version = "*", features = ["derive"] }
|
||||||
figment = { version = "*", features = ["toml", "env", "json"] }
|
figment = { version = "*", features = ["toml", "env", "json"] }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user