From 84c63f9e2f012ef403552c0fa61830a98f53b0bc Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Wed, 5 Apr 2023 18:46:07 -0400 Subject: [PATCH 1/2] squeezelite: add passthru.updateScript --- .../audio/squeezelite/default.nix | 2 ++ pkgs/applications/audio/squeezelite/update.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 pkgs/applications/audio/squeezelite/update.sh diff --git a/pkgs/applications/audio/squeezelite/default.nix b/pkgs/applications/audio/squeezelite/default.nix index fa63fee80065..ff85f7e897da 100644 --- a/pkgs/applications/audio/squeezelite/default.nix +++ b/pkgs/applications/audio/squeezelite/default.nix @@ -78,6 +78,8 @@ stdenv.mkDerivation { runHook postInstall ''; + passthru.updateScript = ./update.sh; + meta = with lib; { description = "Lightweight headless squeezebox client emulator"; homepage = "https://github.com/ralph-irving/squeezelite"; diff --git a/pkgs/applications/audio/squeezelite/update.sh b/pkgs/applications/audio/squeezelite/update.sh new file mode 100755 index 000000000000..d12213f83482 --- /dev/null +++ b/pkgs/applications/audio/squeezelite/update.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p common-updater-scripts coreutils curl gnused jq nix nix-prefetch-github ripgrep + +set -euo pipefail + +latestRev="$(curl -s "https://api.github.com/repos/ralph-irving/squeezelite/commits?per_page=1" | jq -r ".[0].sha")" +latestVersion="$( curl -s https://raw.githubusercontent.com/ralph-irving/squeezelite/${latestRev}/squeezelite.h | rg 'define (MAJOR|MINOR|MICRO)_VERSION' | sed 's/#.*VERSION //' | tr '\n' '.' | sed -e 's/"//g' -e 's/\.$//')" +currentVersion=$(nix-instantiate --eval -E "with import ./. {}; squeezelite.version or (lib.getVersion squeezelite)" | tr -d '"') + +if [[ "$currentVersion" == "$latestVersion" ]]; then + echo "squeezelite is up-to-date: $currentVersion" + exit 0 +fi + +srcHash=$(nix-prefetch-github ralph-irving squeezelite --rev "$latestRev" | jq -r .sha256) +srcHash=$(nix hash to-sri --type sha256 "$srcHash") + + +update-source-version squeezelite "$latestVersion" "$srcHash" --rev="${latestRev}" From e23e82abcf743d4000cd267ba7c0b239f6a67ff2 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Wed, 5 Apr 2023 18:46:13 -0400 Subject: [PATCH 2/2] squeezelite: 1.9.9.1419 -> 1.9.9.1428 --- pkgs/applications/audio/squeezelite/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/audio/squeezelite/default.nix b/pkgs/applications/audio/squeezelite/default.nix index ff85f7e897da..f606f0760576 100644 --- a/pkgs/applications/audio/squeezelite/default.nix +++ b/pkgs/applications/audio/squeezelite/default.nix @@ -34,13 +34,13 @@ stdenv.mkDerivation { pname = binName; # versions are specified in `squeezelite.h` # see https://github.com/ralph-irving/squeezelite/issues/29 - version = "1.9.9.1419"; + version = "1.9.9.1428"; src = fetchFromGitHub { owner = "ralph-irving"; repo = "squeezelite"; - rev = "226efa300c4cf037e8486bad635e9deb3104636f"; - hash = "sha256-ZZWliw1prFbBZMFp0QmXg6MKuHPNuFh2lFxQ8bbuWAM="; + rev = "74fe7934ec60cc31565f088796f56e911f51679c"; + hash = "sha256-85Pz6psyK3VXOIrINcoIeHZT5j9UfJqWIxTavwqHx04="; }; buildInputs = [ flac libmad libvorbis mpg123 ]