From 10d91c0f2fb83586c91579ee5981c14f174b237e Mon Sep 17 00:00:00 2001 From: qubitnano <146656568+qubitnano@users.noreply.github.com> Date: Sun, 20 Apr 2025 11:41:09 -0400 Subject: [PATCH] shipwright: fix dev builds Fallback to empty string for GIT_COMMIT_TAG (this is the behavior of the CMake as well). https://github.com/HarbourMasters/Shipwright/blob/1b6dc13491460462f3a04e56b8fe1a28ada5d2a3/CMakeLists.txt#L68-L70 Grab --port-ver from the CMake cache instead of passing finalAttrs.version. For tagged releases that works fine but the game expects the --port-ver to match the CMake project version even for dev builds so failing to do this will result in the game failing to boot since it thinks there's a version mismatch between the executable and the OTR in the derivation. Author: Sirius902 --- pkgs/by-name/sh/shipwright/package.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/sh/shipwright/package.nix b/pkgs/by-name/sh/shipwright/package.nix index 91bc93f90f6b..baba8dab5f9c 100644 --- a/pkgs/by-name/sh/shipwright/package.nix +++ b/pkgs/by-name/sh/shipwright/package.nix @@ -124,7 +124,7 @@ stdenv.mkDerivation (finalAttrs: { 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 + (git describe --tags --abbrev=0 --exact-match HEAD 2>/dev/null || echo "") > GIT_COMMIT_TAG rm -rf .git ''; }; @@ -213,10 +213,11 @@ stdenv.mkDerivation (finalAttrs: { ''; postBuild = '' + port_ver=$(grep CMAKE_PROJECT_VERSION: "$PWD/CMakeCache.txt" | cut -d= -f2) cp ${gamecontrollerdb}/gamecontrollerdb.txt gamecontrollerdb.txt mv ../libultraship/src/graphic/Fast3D/shaders ../soh/assets/custom pushd ../OTRExporter - python3 ./extract_assets.py -z ../build/ZAPD/ZAPD.out --norom --xml-root ../soh/assets/xml --custom-assets-path ../soh/assets/custom --custom-otr-file soh.otr --port-ver ${finalAttrs.version} + python3 ./extract_assets.py -z ../build/ZAPD/ZAPD.out --norom --xml-root ../soh/assets/xml --custom-assets-path ../soh/assets/custom --custom-otr-file soh.otr --port-ver $port_ver popd '';