Add vesc-tool

This commit is contained in:
Jakob Lechner 2023-03-08 12:00:47 +00:00
parent e8a4de78f2
commit 38bdaa27c8
No known key found for this signature in database
GPG key ID: 996082EFB5906C10
4 changed files with 122 additions and 3 deletions

View file

@ -16,6 +16,7 @@
# $ nix search wget
environment.systemPackages = with pkgs; [
gnome3.adwaita-icon-theme
vesc-tool
];
environment.variables.EDITOR = "nvim";

View file

@ -3,11 +3,13 @@ let
inherit (prev) callPackage;
in
{
pretix = callPackage ./pretix/pretix.nix { };
pretix-static = callPackage ./pretix/pretix-static.nix { };
pretix-banktool = callPackage ./pretix/pretix-banktool.nix { };
fpvout = callPackage ./fpvout { };
mute-indicator = callPackage ./mute-indicator { };
pretix = callPackage ./pretix/pretix.nix { };
pretix-banktool = callPackage ./pretix/pretix-banktool.nix { };
pretix-static = callPackage ./pretix/pretix-static.nix { };
tabbed-box-maker = callPackage ./tabbed-box-maker { };
tradebyte-attendance = callPackage ./tradebyte-attendance { };
vesc-firmware = callPackage ./vesc-tool/firmware.nix { };
vesc-tool = callPackage ./vesc-tool/tool.nix { };
}

View file

@ -0,0 +1,46 @@
{ lib
, stdenv
, fetchFromGitHub
, gcc-arm-embedded-7
, python311
, git
}:
stdenv.mkDerivation rec {
pname = "vesc-firmware";
version = "master";
src = fetchFromGitHub {
owner = "vedderb";
repo = "bldc";
rev = "6.00";
sha256 = "XeIS+3SOKeTkbsx/aCy0FRw/LVXBbLpAqz6upN5HJUY=";
#rev = "5b6cc075d3cfa62bd52a05fad0195fae114d914c";
#sha256 = "SB/mQEYY2Bi2xl5qniKdShMQ0vdrVuLtiWWH4D1U0tw=";
fetchSubmodules = true;
};
nativeBuildInputs = [
gcc-arm-embedded-7
python311
git
# bash
# libsForQt5.qmake
# libsForQt5.qtconnectivity
# libsForQt5.qtgamepad
# libsForQt5.qtlocation
# libsForQt5.qtquickcontrols2
# libsForQt5.qtserialport
];
buildCommand = ''
cp -r $src bldc
(
cd bldc
chmod +w .
#make all_fw_package
make fw_410
)
cp -r bldc/build/* $out
'';
}

70
pkgs/vesc-tool/tool.nix Normal file
View file

@ -0,0 +1,70 @@
{ lib
, stdenv
, fetchFromGitHub
, libsForQt5
, vesc-firmware
, writeText
, qt5
}:
let
qresource = writeText "res_fw.qrc"
''
<RCC>
<qresource>
<file>410.bin</file>
</qresource>
</RCC>
'';
in
stdenv.mkDerivation rec {
pname = "vesc_tool";
version = "master";
src = fetchFromGitHub {
owner = "vedderb";
repo = "vesc_tool";
rev = "6d9d6d7f17c8756a272c267659849ea9c9404efa";
sha256 = "EXXWAwX3yPirhe83wz5/vEectieHeUAkIla7ICxzMow=";
fetchSubmodules = true;
};
nativeBuildInputs = [
libsForQt5.qmake
qt5.wrapQtAppsHook
];
buildInputs = [
vesc-firmware
];
propagatedBuildInputs = with qt5; [
qtconnectivity
qtgamepad
qtlocation
qtquickcontrols2
qtserialport
];
buildPhase = ''
tempdir="$(mktemp -d)"
cp -r "$src/." "$tempdir/"
chmod -R +w "$tempdir"
cd "$tempdir"
mkdir -p res/firmwares/
cp ${qresource} res/firmwares/res_fw.qrc
cp ${vesc-firmware}/*.bin res/firmwares
qmake -config release "CONFIG += release_lin build_platinum"
make clean
make -j8
rm -rf build/lin/obj
mkdir -p $out/bin
cp build/lin/* $out/bin
'';
postFixup = ''
wrapQtApp $out/bin/vesc_tool_6.02
'';
}