Merge pull request #304047 from DontEatOreo/updateScript-stats

stats: add passthru.updateScript
This commit is contained in:
Thiago Kenji Okada 2024-04-25 10:24:09 +01:00 committed by GitHub
commit c0be509b9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,10 @@
, stdenvNoCC
, fetchurl
, undmg
, writeShellApplication
, curl
, jq
, common-updater-scripts
}:
stdenvNoCC.mkDerivation (finalAttrs: {
@ -12,6 +16,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
url = "https://github.com/exelban/stats/releases/download/v${finalAttrs.version}/Stats.dmg";
hash = "sha256-CdTY5Qv/xF9ItNgHQFqec5nKObnImx/+MuFShTfdrAo=";
};
sourceRoot = ".";
nativeBuildInputs = [ undmg ];
@ -25,12 +30,23 @@ stdenvNoCC.mkDerivation (finalAttrs: {
runHook postInstall
'';
passthru.updateScript = lib.getExe (writeShellApplication {
name = "stats-update-script";
runtimeInputs = [ curl jq common-updater-scripts ];
text = ''
set -euo pipefail
url="$(curl --silent "https://api.github.com/repos/exelban/stats/tags?per_page=1")"
version="$(echo "$url" | jq -r '.[0].name' | cut -c 2-)"
update-source-version stats "$version" --file=./pkgs/by-name/st/stats/package.nix
'';
});
meta = with lib; {
description = "macOS system monitor in your menu bar";
homepage = "https://github.com/exelban/stats";
license = licenses.mit;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
maintainers = with maintainers; [ emilytrau Enzime ];
maintainers = with maintainers; [ emilytrau Enzime donteatoreo ];
platforms = platforms.darwin;
};
})