linuswck
764a203dd8
- stm32-eth crate requires stm32f4xx-hal 0.14.0 and smoltcp 0.10.0 - its dependency packages requires rustc 1.67 or above (1.67.1 is chosen)
81 lines
2.5 KiB
Nix
81 lines
2.5 KiB
Nix
{
|
|
description = "Firmware for kirdy";
|
|
|
|
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05;
|
|
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
|
|
|
|
outputs = { self, nixpkgs, mozilla-overlay }:
|
|
let
|
|
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) ]; };
|
|
rustManifest = pkgs.fetchurl {
|
|
url = "https://static.rust-lang.org/dist/2023-02-09/channel-rust-stable.toml";
|
|
sha256 = "4b8740ee77b62291471be1278d77e8826ab01b20c54915859c9f1ccb8299af59";
|
|
};
|
|
|
|
targets = [
|
|
"thumbv7em-none-eabihf"
|
|
];
|
|
rustChannelOfTargets = _channel: _date: targets:
|
|
(pkgs.lib.rustLib.fromManifestFile rustManifest {
|
|
inherit (pkgs) stdenv lib fetchurl patchelf;
|
|
}).rust.override {
|
|
inherit targets;
|
|
extensions = ["rust-src"];
|
|
};
|
|
rust = rustChannelOfTargets "stable" null targets;
|
|
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
|
|
rustc = rust;
|
|
cargo = rust;
|
|
});
|
|
kirdy = rustPlatform.buildRustPackage rec {
|
|
name = "kirdy";
|
|
version = "0.0.0";
|
|
|
|
src = self;
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
};
|
|
|
|
nativeBuildInputs = [ pkgs.llvm ];
|
|
|
|
buildPhase = ''
|
|
cargo build --release --bin kirdy
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out $out/nix-support
|
|
cp target/thumbv7em-none-eabihf/release/kirdy $out/kirdy.elf
|
|
echo file binary-dist $out/kirdy.elf >> $out/nix-support/hydra-build-products
|
|
llvm-objcopy -O binary target/thumbv7em-none-eabihf/release/kirdy $out/kirdy.bin
|
|
echo file binary-dist $out/kirdy.bin >> $out/nix-support/hydra-build-products
|
|
'';
|
|
|
|
dontFixup = true;
|
|
};
|
|
in {
|
|
packages.x86_64-linux = {
|
|
inherit kirdy;
|
|
};
|
|
|
|
hydraJobs = {
|
|
inherit kirdy;
|
|
};
|
|
|
|
devShell.x86_64-linux = pkgs.mkShell {
|
|
name = "kirdy-dev-shell";
|
|
buildInputs = with pkgs; [
|
|
rustPlatform.rust.rustc
|
|
rustPlatform.rust.cargo
|
|
openocd dfu-util glibc
|
|
] ++ (with python3Packages; [
|
|
numpy matplotlib pyqtgraph
|
|
]);
|
|
shellHook=
|
|
''
|
|
export QT_PLUGIN_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtPluginPrefix}
|
|
export QML2_IMPORT_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.dev.qtQmlPrefix}
|
|
'';
|
|
};
|
|
defaultPackage.x86_64-linux = kirdy;
|
|
};
|
|
} |