mirror of
https://github.com/icewind1991/cynthion-flake.git
synced 2026-06-03 14:24:07 +02:00
42 lines
961 B
Nix
42 lines
961 B
Nix
{
|
|
makeRustPlatform,
|
|
rustc,
|
|
cynthion-unwrapped,
|
|
zsh,
|
|
yosys,
|
|
nextpnr,
|
|
trellis,
|
|
rust-bin,
|
|
pkgsCross,
|
|
...
|
|
}: let
|
|
# this doesn't work yet...
|
|
toolchain = rust-bin.stable.${rustc.version}.default.override {
|
|
extensions = ["rust-src"];
|
|
targets = ["riscv32imac-unknown-none-elf"];
|
|
};
|
|
rustPlatform = pkgsCross.riscv32-embedded.pkgsBuildHost.makeRustPlatform {
|
|
cargo = toolchain;
|
|
rustc = toolchain;
|
|
};
|
|
in
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "cynthion-moondancer";
|
|
inherit (cynthion-unwrapped) version src;
|
|
|
|
postPatch = ''
|
|
cp ${./moondancer-cargo.lock} Cargo.lock
|
|
|
|
substituteInPlace Cargo.toml \
|
|
--replace-fail '[profile.release]' "[profile.release]
|
|
panic=\"abort\""
|
|
'';
|
|
|
|
cargoLock = {
|
|
lockFile = ./moondancer-cargo.lock;
|
|
};
|
|
|
|
sourceRoot = "source/firmware";
|
|
|
|
cargoBuildFlags = ["-p moondancer" "--target riscv32imac-unknown-none-elf"];
|
|
}
|