Skip to content

Commit

Permalink
mactracker: 7.13 -> 7.13.2 (#371090)
Browse files Browse the repository at this point in the history
  • Loading branch information
misuzu authored Jan 10, 2025
2 parents 8824306 + 2b2be7f commit 3f14b85
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions pkgs/by-name/ma/mactracker/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
stdenvNoCC,
fetchurl,
unzip,
writeShellApplication,
curl,
cacert,
libxml2,
xmlstarlet,
common-updater-scripts,
versionCheckHook,
writeShellScript,
xcbuild,
}:

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;
Expand All @@ -31,6 +40,29 @@ 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"
'';
});

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";
Expand Down

0 comments on commit 3f14b85

Please sign in to comment.