nix/pkgs/flipperzero-firmware: init
This commit is contained in:
parent
847174f08e
commit
c01a1fee3a
3 changed files with 125 additions and 0 deletions
|
@ -71,4 +71,5 @@
|
|||
nixos-size = pkgs.callPackage ./nixos-size { };
|
||||
|
||||
authentik = import ./authentik args;
|
||||
flipperzero-firmware = import ./flipperzero-firmware args;
|
||||
} // (import ./heptapod-runner args)
|
||||
|
|
81
nix/pkgs/flipperzero-firmware/default.nix
Normal file
81
nix/pkgs/flipperzero-firmware/default.nix
Normal file
|
@ -0,0 +1,81 @@
|
|||
{ 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.65.3-0827-RMv2";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "RogueMaster";
|
||||
repo = "flipperzero-firmware-wPlugins";
|
||||
rev = version;
|
||||
fetchSubmodules = true;
|
||||
sha256 = "01kdv4rld3ahp0wgb4ha0q2l8gspk7033li1bm5jgzggrkhyvgv1";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./fbt_assets_protobuf_version_from_changelog.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = deps;
|
||||
|
||||
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
|
||||
|
||||
./fbt -j$NIX_BUILD_CORES --with-updater COMPACT=1 DEBUG=0 updater_package
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -r dist/f7-C $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.deps = deps;
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
diff --git a/site_scons/site_tools/fbt_assets.py b/site_scons/site_tools/fbt_assets.py
|
||||
index f91fcfed..e83d8fa7 100644
|
||||
--- a/site_scons/site_tools/fbt_assets.py
|
||||
+++ b/site_scons/site_tools/fbt_assets.py
|
||||
@@ -67,28 +67,17 @@ def _invoke_git(args, source_dir):
|
||||
|
||||
|
||||
def proto_ver_generator(target, source, env):
|
||||
+ changelog_content = source[0].get_text_contents()
|
||||
+ for ln in changelog_content.split('\n'):
|
||||
+ ln = ln.strip()
|
||||
+ if ln.startswith('## ['):
|
||||
+ version = ln[len('## ['):-1]
|
||||
+ break
|
||||
+ else:
|
||||
+ print("couldn't parse version from changelog " + str(source[0]))
|
||||
+ Exit()
|
||||
target_file = target[0]
|
||||
- src_dir = source[0].dir.abspath
|
||||
- try:
|
||||
- git_fetch = _invoke_git(
|
||||
- ["fetch", "--tags"],
|
||||
- source_dir=src_dir,
|
||||
- )
|
||||
- except (subprocess.CalledProcessError, EnvironmentError) as e:
|
||||
- # Not great, not terrible
|
||||
- print("Git: fetch failed")
|
||||
-
|
||||
- try:
|
||||
- git_describe = _invoke_git(
|
||||
- ["describe", "--tags", "--abbrev=0"],
|
||||
- source_dir=src_dir,
|
||||
- )
|
||||
- except (subprocess.CalledProcessError, EnvironmentError) as e:
|
||||
- print("Git: describe failed")
|
||||
- Exit("git error")
|
||||
-
|
||||
- # print("describe=", git_describe)
|
||||
- git_major, git_minor = git_describe.split(".")
|
||||
+ git_major, git_minor = version.split(".")
|
||||
version_file_data = (
|
||||
"#pragma once",
|
||||
f"#define PROTOBUF_MAJOR_VERSION {git_major}",
|
Loading…
Reference in a new issue