depot/nix/pkgs/flipperzero-firmware/default.nix

93 lines
2 KiB
Nix

{ pkgs ? import <nixpkgs> {}
, ... }:
let
heatshrink2 = pm: pm.buildPythonPackage rec {
pname = "heatshrink2";
version = "0.11.0";
src = pkgs.fetchFromGitHub {
owner = "eerimoq";
repo = "pyheatshrink";
rev = version;
hash = "sha256:1122abg9yf3shbb3h6kzh8f8vmhgxy1w9ck0mjg1zqyncry2hwiz";
fetchSubmodules = true;
};
propagatedBuildInputs = with pm; [
cython
];
};
python-with-deps = pkgs.python3.withPackages (pm: with pm; [
pillow
(heatshrink2 pm)
protobuf
setuptools
pyserial
grpcio
grpcio-tools
]);
deps = with pkgs; [
gcc-arm-embedded
openocd
clang
dfu-util
git
protobuf
python-with-deps
];
in
pkgs.stdenvNoCC.mkDerivation rec {
pname = "flipper-firmware";
version = "0.69.2-1020-RM";
src = pkgs.fetchgit {
url = "https://github.com/RogueMaster/flipperzero-firmware-wPlugins.git";
rev = version;
fetchSubmodules = true;
sha256 = "05xink9rq3np1d2qdynxxbabcc7vbkr8im4hwx6dbk8zwlnmfyb1";
};
patches = [
./0001-simply-do-not-run-git.patch
./0002-proto_ver_generator-use-changelog-not-git.patch
./0003-scripts-fbt-version-no-git.patch
./0004-scripts-sconsdist-disable-strict_timestamps-allow-FS.patch
];
nativeBuildInputs = deps;
WORKFLOW_BRANCH_OR_TAG = version;
DIST_SUFFIX = "";
CUSTOM_FLIPPER_NAME = "";
FBT_NOENV = 1;
FBT_NO_SYNC = 1;
buildPhase = ''
runHook preBuild
mkdir -p $NIX_BUILD_TOP/bin
ln -s $(command -v arm-none-eabi-gcc) $NIX_BUILD_TOP/bin/arm-none-eabi-cc
export PATH=$NIX_BUILD_TOP/bin:$PATH
export WORKFLOW_BRANCH_OR_TAG DIST_SUFFIX CUSTOM_FLIPPER_NAME
echo building icons
./fbt icons
echo building resources
./fbt -j$NIX_BUILD_CORES COMPACT=1 DEBUG=0 resources icons
echo building firmware
./fbt -j$NIX_BUILD_CORES --with-updater COMPACT=1 DEBUG=0 updater_package
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist $out
runHook postInstall
'';
passthru.deps = deps;
}