Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .bestool.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ lib
, pkgs
, rustPlatform
,
}:
rustPlatform.buildRustPackage {
name = "bestool";

src = ./bestool;

cargoLock = {
lockFile = ./bestool/Cargo.lock;
allowBuiltinFetchGit = true;
};

nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ systemd.dev ];

meta = with lib; {
description = "";
homepage = "https://github.com/Ralim/bestool";
platforms = platforms.linux;
maintainers = with maintainers; [ shymega ];
license = licenses.mit;
};
}
Binary file added bestool/res/chunk1.bin
Binary file not shown.
Binary file added bestool/res/chunk2.bin
Binary file not shown.
Binary file added bestool/res/programmer.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion bestool/src/beslink/bootloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::io::Write;
use tracing::error;
use tracing::info;
//Embed the bin file for future
const PROGRAMMER_BINARY: &[u8; 75928] = include_bytes!("../../../programmer.bin");
const PROGRAMMER_BINARY: &[u8; 75928] = include_bytes!("../../res/programmer.bin");

pub fn load_programmer_runtime_binary_blob(
serial_port: &mut Box<dyn SerialPort>,
Expand Down
4 changes: 2 additions & 2 deletions bestool/src/beslink/write_flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ mod tests {
use crate::beslink::write_flash::get_flash_chunk_msg;

//Embed the bin file for future
const CHUNK1_TEST: &[u8; 32768] = include_bytes!("../../../chunk1.bin");
const CHUNK2_TEST: &[u8; 32768] = include_bytes!("../../../chunk2.bin");
const CHUNK1_TEST: &[u8; 32768] = include_bytes!("../../res/chunk1.bin");
const CHUNK2_TEST: &[u8; 32768] = include_bytes!("../../res/chunk2.bin");

#[test]
fn test_get_flash_chunk_msg() {
Expand Down
78 changes: 78 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs =
{ self
, nixpkgs
, flake-utils
, ...
}:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
};
in
with pkgs; {
packages.bestool = callPackage ./.bestool.nix { };
packages.default = self.packages.${system}.bestool;

devShells.default = mkShell {
inputsFrom = lib.singleton self.packages.${system}.default;
buildInputs = [
cargo-edit
clippy
rustfmt
];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
})
// {
overlays.default = final: prev: {
inherit (self.packages.${final.system}) bestool;
};
};
}
Loading