diff options
author | Nick Cao <nickcao@nichi.co> | 2024-04-25 10:19:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-25 10:19:51 -0400 |
commit | 49fcbf37cbe464792e2265e7e0a6d669616a0143 (patch) | |
tree | 02befa55b876bf534c280a95f7c679fa678f2600 /pkgs/by-name | |
parent | 2d3016f15d4899acc4684a043c398dc869438f80 (diff) | |
parent | 3a16cf1ad457c9eae7806aaa628132f8617fec7c (diff) |
Merge pull request #306740 from NixOS/backport-304047-to-release-23.11
[Backport release-23.11] stats: add passthru.updateScript
Diffstat (limited to 'pkgs/by-name')
-rw-r--r-- | pkgs/by-name/st/stats/package.nix | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/by-name/st/stats/package.nix b/pkgs/by-name/st/stats/package.nix index ed71e50f2bae4..b907d5b2db817 100644 --- a/pkgs/by-name/st/stats/package.nix +++ b/pkgs/by-name/st/stats/package.nix @@ -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; }; }) |