From e02b14bdba1ea6086bef69029639c81d6e65737d Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sat, 24 Jan 2026 23:19:41 +0100 Subject: [PATCH] openttd-grfcodec: unstable-2021-03-10 -> 6.2.0, embed and check version information --- pkgs/by-name/op/openttd-grfcodec/package.nix | 24 ++++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/op/openttd-grfcodec/package.nix b/pkgs/by-name/op/openttd-grfcodec/package.nix index 292fa0de4a7f..a4f5a981fa8b 100644 --- a/pkgs/by-name/op/openttd-grfcodec/package.nix +++ b/pkgs/by-name/op/openttd-grfcodec/package.nix @@ -5,25 +5,39 @@ boost, cmake, git, + versionCheckHook, }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "openttd-grfcodec"; - version = "unstable-2021-03-10"; + version = "6.2.0"; src = fetchFromGitHub { owner = "OpenTTD"; repo = "grfcodec"; - rev = "045774dee7cab1a618a3e0d9b39bff78a12b6efa"; - sha256 = "0b4xnnkqc01d3r834lhkq744ymar6c8iyxk51wc4c7hvz0vp9vmy"; + tag = finalAttrs.version; + hash = "sha256-zIRHo2glD738Rmg4dhetIGtbIY/AgMKnzAJaP00lsqk="; + leaveDotGit = true; + postFetch = '' + # git arguments taken from generate_version.cmake + git_date=$(git -C $out show -s --pretty=%cd --date=short) + echo "${finalAttrs.version};$git_date" > $out/.version + rm -rf $out/.git + ''; }; buildInputs = [ boost ]; + nativeBuildInputs = [ cmake git ]; + nativeInstallCheckInputs = [ versionCheckHook ]; + + doInstallCheck = true; + versionCheckProgram = "${placeholder "out"}/bin/grfcodec"; + installPhase = '' mkdir -p $out/bin cp -a grfcodec grfid grfstrip nforenum $out/bin/ @@ -35,4 +49,4 @@ stdenv.mkDerivation { license = lib.licenses.gpl2Plus; maintainers = with lib.maintainers; [ ToxicFrog ]; }; -} +})