2023-02-10 21:01:32 +00:00
|
|
|
{ depot
|
|
|
|
, pkgs ? import <nixpkgs> {}
|
2022-08-28 16:33:45 +00:00
|
|
|
, ... }:
|
|
|
|
|
|
|
|
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
|
|
|
|
];
|
|
|
|
};
|
2022-12-04 06:40:03 +00:00
|
|
|
scons = pkgs.scons.overridePythonAttrs (_: rec {
|
|
|
|
version = "4.4.0";
|
|
|
|
src = pkgs.fetchurl {
|
|
|
|
url = "mirror://sourceforge/scons/scons/${version}/SCons-${version}.tar.gz";
|
|
|
|
sha256 = "0pv836q2j37w29hg5w5d7ssjfglv9kq5yd0v1vm1cj4j78qb4hrx";
|
|
|
|
};
|
|
|
|
});
|
2022-08-28 16:33:45 +00:00
|
|
|
python-with-deps = pkgs.python3.withPackages (pm: with pm; [
|
|
|
|
pillow
|
|
|
|
(heatshrink2 pm)
|
|
|
|
protobuf
|
|
|
|
setuptools
|
|
|
|
pyserial
|
|
|
|
grpcio
|
|
|
|
grpcio-tools
|
2022-12-04 06:40:03 +00:00
|
|
|
(pm.toPythonModule scons)
|
|
|
|
ansi
|
|
|
|
colorlog
|
2022-08-28 16:33:45 +00:00
|
|
|
]);
|
|
|
|
deps = with pkgs; [
|
2022-12-04 05:37:18 +00:00
|
|
|
gcc-arm-embedded-10
|
2022-08-28 16:33:45 +00:00
|
|
|
openocd
|
|
|
|
clang
|
|
|
|
dfu-util
|
|
|
|
git
|
|
|
|
protobuf
|
|
|
|
python-with-deps
|
|
|
|
];
|
|
|
|
in
|
|
|
|
pkgs.stdenvNoCC.mkDerivation rec {
|
|
|
|
pname = "flipper-firmware";
|
2023-02-10 21:01:32 +00:00
|
|
|
version = "RM0209-2252-0.76.1-dcbe3cd";
|
|
|
|
upstreamVersion = "0.76.1";
|
2022-08-28 16:33:45 +00:00
|
|
|
|
2022-08-28 20:47:44 +00:00
|
|
|
src = pkgs.fetchgit {
|
2022-08-28 19:58:32 +00:00
|
|
|
url = "https://github.com/RogueMaster/flipperzero-firmware-wPlugins.git";
|
2023-02-10 21:01:32 +00:00
|
|
|
rev = "dcbe3cd255bc2c2d5da9d3f2859a11f45d8bc2d4";
|
2022-08-28 16:33:45 +00:00
|
|
|
fetchSubmodules = true;
|
2023-02-10 21:01:32 +00:00
|
|
|
sha256 = "1zs10b9rxbbxcwv9r28q8vyx3jkkg71mg4xfpf18zmkzj3wczaiv";
|
2022-08-28 20:47:44 +00:00
|
|
|
};
|
2022-08-28 16:33:45 +00:00
|
|
|
|
|
|
|
patches = [
|
2022-10-22 19:17:54 +00:00
|
|
|
./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
|
2022-08-28 16:33:45 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = deps;
|
|
|
|
|
2022-08-28 20:47:44 +00:00
|
|
|
WORKFLOW_BRANCH_OR_TAG = version;
|
|
|
|
DIST_SUFFIX = "";
|
|
|
|
CUSTOM_FLIPPER_NAME = "";
|
|
|
|
|
2022-08-28 16:33:45 +00:00
|
|
|
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
|
2022-08-28 20:47:44 +00:00
|
|
|
export WORKFLOW_BRANCH_OR_TAG DIST_SUFFIX CUSTOM_FLIPPER_NAME
|
2022-08-28 16:33:45 +00:00
|
|
|
|
2022-10-22 19:17:54 +00:00
|
|
|
echo building icons
|
|
|
|
./fbt icons
|
|
|
|
echo building resources
|
|
|
|
./fbt -j$NIX_BUILD_CORES COMPACT=1 DEBUG=0 resources icons
|
|
|
|
echo building firmware
|
2022-08-28 16:33:45 +00:00
|
|
|
./fbt -j$NIX_BUILD_CORES --with-updater COMPACT=1 DEBUG=0 updater_package
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2022-10-22 19:17:54 +00:00
|
|
|
cp -r dist $out
|
2022-08-28 16:33:45 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.deps = deps;
|
2023-02-10 21:01:32 +00:00
|
|
|
passthru.upload = let
|
|
|
|
firmware = depot.nix.pkgs.flipperzero-firmware;
|
|
|
|
in pkgs.writeShellApplication {
|
|
|
|
name = "upload-f0";
|
|
|
|
runtimeInputs = [ pkgs.google-cloud-sdk ];
|
|
|
|
text = ''
|
|
|
|
echo "Uploading ${firmware.version}"
|
|
|
|
gcloud storage cp "${firmware}/f7-C/*-update-*.tgz" "gs://lukegb-flipperzero/${firmware.name}.tgz"
|
|
|
|
'';
|
|
|
|
};
|
2022-08-28 16:33:45 +00:00
|
|
|
}
|