diff --git a/nix/pkgs/flipperzero-firmware/no_version_git.patch b/nix/pkgs/flipperzero-firmware/0001-simply-do-not-run-git.patch similarity index 58% rename from nix/pkgs/flipperzero-firmware/no_version_git.patch rename to nix/pkgs/flipperzero-firmware/0001-simply-do-not-run-git.patch index da5932cd43..7d72f74aac 100644 --- a/nix/pkgs/flipperzero-firmware/no_version_git.patch +++ b/nix/pkgs/flipperzero-firmware/0001-simply-do-not-run-git.patch @@ -1,5 +1,14 @@ +From 76176935f5f9bf6347658c64d2c6f30711830b80 Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +Date: Sat, 22 Oct 2022 19:33:07 +0100 +Subject: [PATCH 1/4] simply do not run git + +--- + scripts/version.py | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + diff --git a/scripts/version.py b/scripts/version.py -index 3c04b7e1..cd4ebe47 100644 +index 12a684391..1c8411ca9 100644 --- a/scripts/version.py +++ b/scripts/version.py @@ -61,13 +61,7 @@ class GitVersion: @@ -17,3 +26,6 @@ index 3c04b7e1..cd4ebe47 100644 class Main(App): +-- +2.37.2 + diff --git a/nix/pkgs/flipperzero-firmware/fbt_assets_protobuf_version_from_changelog.patch b/nix/pkgs/flipperzero-firmware/0002-proto_ver_generator-use-changelog-not-git.patch similarity index 67% rename from nix/pkgs/flipperzero-firmware/fbt_assets_protobuf_version_from_changelog.patch rename to nix/pkgs/flipperzero-firmware/0002-proto_ver_generator-use-changelog-not-git.patch index df46d191f4..a47b57c5c6 100644 --- a/nix/pkgs/flipperzero-firmware/fbt_assets_protobuf_version_from_changelog.patch +++ b/nix/pkgs/flipperzero-firmware/0002-proto_ver_generator-use-changelog-not-git.patch @@ -1,8 +1,17 @@ -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): +From e7e503880ef3d74eab320a0f9f9aa639947b1b82 Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +Date: Sat, 22 Oct 2022 19:35:00 +0100 +Subject: [PATCH 2/4] proto_ver_generator: use changelog, not git + +--- + scripts/fbt_tools/fbt_assets.py | 30 ++++++++++-------------------- + 1 file changed, 10 insertions(+), 20 deletions(-) + +diff --git a/scripts/fbt_tools/fbt_assets.py b/scripts/fbt_tools/fbt_assets.py +index f058d15f9..59854739f 100644 +--- a/scripts/fbt_tools/fbt_assets.py ++++ b/scripts/fbt_tools/fbt_assets.py +@@ -67,28 +67,18 @@ def _invoke_git(args, source_dir): def proto_ver_generator(target, source, env): @@ -34,10 +43,13 @@ index f91fcfed..e83d8fa7 100644 - 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}", +-- +2.37.2 + diff --git a/nix/pkgs/flipperzero-firmware/0003-scripts-fbt-version-no-git.patch b/nix/pkgs/flipperzero-firmware/0003-scripts-fbt-version-no-git.patch new file mode 100644 index 0000000000..c6dfcddb4c --- /dev/null +++ b/nix/pkgs/flipperzero-firmware/0003-scripts-fbt-version-no-git.patch @@ -0,0 +1,50 @@ +From 2dc46cf7bab7c8fac5b7959e198a90a8b89b2c9b Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +Date: Sat, 22 Oct 2022 19:40:33 +0100 +Subject: [PATCH 3/4] scripts/fbt/version: no git + +--- + scripts/fbt/version.py | 20 +++----------------- + 1 file changed, 3 insertions(+), 17 deletions(-) + +diff --git a/scripts/fbt/version.py b/scripts/fbt/version.py +index e7fe2edaf..c07bc2915 100644 +--- a/scripts/fbt/version.py ++++ b/scripts/fbt/version.py +@@ -1,30 +1,16 @@ +-import subprocess + import datetime + from functools import cache ++import os + + + @cache + def get_git_commit_unix_timestamp(): +- return int(subprocess.check_output(["git", "show", "-s", "--format=%ct"])) ++ return int(os.environ.get('SOURCE_DATE_EPOCH', 0)) + + + @cache + def get_fast_git_version_id(): + try: +- version = ( +- subprocess.check_output( +- [ +- "git", +- "describe", +- "--always", +- "--dirty", +- "--all", +- "--long", +- ] +- ) +- .strip() +- .decode() +- ) +- return (version, datetime.date.today()) ++ return (str(get_git_commit_unix_timestamp()), datetime.date.today()) + except Exception as e: + print("Failed to check for git changes", e) +-- +2.37.2 + diff --git a/nix/pkgs/flipperzero-firmware/0004-scripts-sconsdist-disable-strict_timestamps-allow-FS.patch b/nix/pkgs/flipperzero-firmware/0004-scripts-sconsdist-disable-strict_timestamps-allow-FS.patch new file mode 100644 index 0000000000..3c796b1b02 --- /dev/null +++ b/nix/pkgs/flipperzero-firmware/0004-scripts-sconsdist-disable-strict_timestamps-allow-FS.patch @@ -0,0 +1,25 @@ +From 67ea1d3dc32a3a9d4191a325b33a9e8d9f4f934e Mon Sep 17 00:00:00 2001 +From: Luke Granger-Brown +Date: Sat, 22 Oct 2022 19:50:27 +0100 +Subject: [PATCH 4/4] scripts/sconsdist: disable strict_timestamps - allow FS + timestamps pre 1980 + +--- + scripts/sconsdist.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/scripts/sconsdist.py b/scripts/sconsdist.py +index 5f38ec980..270335e1f 100644 +--- a/scripts/sconsdist.py ++++ b/scripts/sconsdist.py +@@ -77,6 +77,7 @@ class Main(App): + self.get_dist_filepath(self.get_project_filename(project, "zip")), + "w", + zipfile.ZIP_DEFLATED, ++ strict_timestamps=False, + ) as zf: + for root, dirs, files in walk(sdk_folder): + for file in files: +-- +2.37.2 + diff --git a/nix/pkgs/flipperzero-firmware/default.nix b/nix/pkgs/flipperzero-firmware/default.nix index cb3ffd1f94..7f2f2d15fc 100644 --- a/nix/pkgs/flipperzero-firmware/default.nix +++ b/nix/pkgs/flipperzero-firmware/default.nix @@ -39,18 +39,20 @@ let in pkgs.stdenvNoCC.mkDerivation rec { pname = "flipper-firmware"; - version = "0.65.3-0827-RMv2"; + version = "0.69.2-1020-RM"; src = pkgs.fetchgit { url = "https://github.com/RogueMaster/flipperzero-firmware-wPlugins.git"; rev = version; fetchSubmodules = true; - sha256 = "09hmbvv5fgn4y2cz95kcq5lm1rkj776xv06haqhah0s823wk623m"; + sha256 = "05xink9rq3np1d2qdynxxbabcc7vbkr8im4hwx6dbk8zwlnmfyb1"; }; patches = [ - ./fbt_assets_protobuf_version_from_changelog.patch - ./no_version_git.patch + ./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; @@ -69,6 +71,11 @@ pkgs.stdenvNoCC.mkDerivation rec { 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 @@ -77,7 +84,7 @@ pkgs.stdenvNoCC.mkDerivation rec { installPhase = '' runHook preInstall - cp -r dist/f7-C $out + cp -r dist $out runHook postInstall '';