From 07679c4cc1909da9a0709382e4f48caa0904c360 Mon Sep 17 00:00:00 2001 From: Dimitar Nestorov <8790386+dimitarnestorov@users.noreply.github.com> Date: Sun, 5 Jan 2025 11:03:59 +0200 Subject: [PATCH 1/3] mactracker: add update script --- pkgs/by-name/ma/mactracker/package.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pkgs/by-name/ma/mactracker/package.nix b/pkgs/by-name/ma/mactracker/package.nix index faf8d004e70a6..5b5cdc6cb2591 100644 --- a/pkgs/by-name/ma/mactracker/package.nix +++ b/pkgs/by-name/ma/mactracker/package.nix @@ -3,6 +3,12 @@ stdenvNoCC, fetchurl, unzip, + writeShellApplication, + curl, + cacert, + libxml2, + xmlstarlet, + common-updater-scripts, }: stdenvNoCC.mkDerivation (finalAttrs: { @@ -31,6 +37,22 @@ stdenvNoCC.mkDerivation (finalAttrs: { runHook postInstall ''; + passthru.updateScript = lib.getExe (writeShellApplication { + name = "mactracker-update-script"; + runtimeInputs = [ + curl + cacert + libxml2 + xmlstarlet + common-updater-scripts + ]; + text = '' + url="https://mactracker.ca/releasenotes-mac.html" + version=$(curl -s "$url" | xmllint -html -xmlout - | xmlstarlet sel -t -v "//faq/h5[1]") + update-source-version mactracker "$version" + ''; + }); + meta = { description = "Mactracker provides detailed information on every Apple Macintosh, iPod, iPhone, iPad, and Apple Watch ever made"; homepage = "https://mactracker.ca"; From fef34957c967257e7b5790f6df80e64629e22a60 Mon Sep 17 00:00:00 2001 From: Dimitar Nestorov <8790386+dimitarnestorov@users.noreply.github.com> Date: Sun, 5 Jan 2025 11:09:03 +0200 Subject: [PATCH 2/3] mactracker: 7.13 -> 7.13.2 --- pkgs/by-name/ma/mactracker/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ma/mactracker/package.nix b/pkgs/by-name/ma/mactracker/package.nix index 5b5cdc6cb2591..9ee5c07704cf2 100644 --- a/pkgs/by-name/ma/mactracker/package.nix +++ b/pkgs/by-name/ma/mactracker/package.nix @@ -13,11 +13,11 @@ stdenvNoCC.mkDerivation (finalAttrs: { pname = "mactracker"; - version = "7.13"; + version = "7.13.2"; src = fetchurl { url = "https://mactracker.ca/downloads/Mactracker_${finalAttrs.version}.zip"; - hash = "sha256-GbaGhYF9Pf3EpzoLQd9fkWYxHFwCkYdlRyy33lieUxM="; + hash = "sha256-Ns2es6uMqfHKmeVV6ehGXV0pNtv2T3eNYLnRvsjOhpE="; }; dontPatch = true; From 2b2be7f8a892e2de458b342a8551a11b954b323b Mon Sep 17 00:00:00 2001 From: Dimitar Nestorov <8790386+dimitarnestorov@users.noreply.github.com> Date: Sun, 5 Jan 2025 12:36:09 +0200 Subject: [PATCH 3/3] mactracker: add version check --- pkgs/by-name/ma/mactracker/package.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/by-name/ma/mactracker/package.nix b/pkgs/by-name/ma/mactracker/package.nix index 9ee5c07704cf2..430373fe90c58 100644 --- a/pkgs/by-name/ma/mactracker/package.nix +++ b/pkgs/by-name/ma/mactracker/package.nix @@ -9,6 +9,9 @@ libxml2, xmlstarlet, common-updater-scripts, + versionCheckHook, + writeShellScript, + xcbuild, }: stdenvNoCC.mkDerivation (finalAttrs: { @@ -53,6 +56,13 @@ stdenvNoCC.mkDerivation (finalAttrs: { ''; }); + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = writeShellScript "version-check" '' + ${xcbuild}/bin/PlistBuddy -c "Print :CFBundleVersion" "$1" + ''; + versionCheckProgramArg = [ "${placeholder "out"}/Applications/Mactracker.app/Contents/Info.plist" ]; + doInstallCheck = true; + meta = { description = "Mactracker provides detailed information on every Apple Macintosh, iPod, iPhone, iPad, and Apple Watch ever made"; homepage = "https://mactracker.ca";