shipwright: include git build details

These git commands can't run in the sandbox, so populate them ourselves
This commit is contained in:
qubitnano
2025-04-20 11:41:21 -04:00
parent ea78596393
commit 10218c015d
+15
View File
@@ -119,6 +119,14 @@ stdenv.mkDerivation (finalAttrs: {
tag = finalAttrs.version;
hash = "sha256-xmRUUMjQt3CFJ0GxlUsUqmp//XTRWik3jSD4auql7Nk=";
fetchSubmodules = true;
deepClone = true;
postFetch = ''
cd $out
git branch --show-current > GIT_BRANCH
git rev-parse --short=7 HEAD > GIT_COMMIT_HASH
git describe --tags --abbrev=0 --exact-match HEAD > GIT_COMMIT_TAG
rm -rf .git
'';
};
patches = [
@@ -197,6 +205,13 @@ stdenv.mkDerivation (finalAttrs: {
--replace-fail "\''${STB_DIR}" "$(readlink -f ./stb)"
'';
postPatch = ''
substituteInPlace soh/src/boot/build.c.in \
--replace-fail "@CMAKE_PROJECT_GIT_BRANCH@" "$(cat GIT_BRANCH)" \
--replace-fail "@CMAKE_PROJECT_GIT_COMMIT_HASH@" "$(cat GIT_COMMIT_HASH)" \
--replace-fail "@CMAKE_PROJECT_GIT_COMMIT_TAG@" "$(cat GIT_COMMIT_TAG)"
'';
postBuild = ''
cp ${gamecontrollerdb}/gamecontrollerdb.txt gamecontrollerdb.txt
mv ../libultraship/src/graphic/Fast3D/shaders ../soh/assets/custom