diff options
Diffstat (limited to 'pkgs/applications/audio/plexamp')
-rw-r--r-- | pkgs/applications/audio/plexamp/default.nix | 13 | ||||
-rwxr-xr-x | pkgs/applications/audio/plexamp/update-plexamp.sh | 54 |
2 files changed, 62 insertions, 5 deletions
diff --git a/pkgs/applications/audio/plexamp/default.nix b/pkgs/applications/audio/plexamp/default.nix index caa703f59ce..9921c1b7e88 100644 --- a/pkgs/applications/audio/plexamp/default.nix +++ b/pkgs/applications/audio/plexamp/default.nix @@ -2,13 +2,13 @@ let pname = "plexamp"; - version = "3.1.1"; + version = "3.5.0"; name = "${pname}-${version}"; src = fetchurl { url = "https://plexamp.plex.tv/plexamp.plex.tv/desktop/Plexamp-${version}.AppImage"; - sha256 = "11hgcysa1x9yqvha6ri4vl1zk8gf8vhcpnh3j38wg9ncd7nz5k2v"; name="${pname}-${version}.AppImage"; + sha512 = "NjhrtGQsIbNDmGPEDmEbaHSfvUTFb1e7yPorF/BzWTfwVoFZEJiNzP/1k+zTJ4Yfd4mG0W0GYx0jh8m/micWIg=="; }; appimageContents = appimageTools.extractType2 { @@ -25,15 +25,18 @@ in appimageTools.wrapType2 { install -m 444 -D ${appimageContents}/plexamp.desktop $out/share/applications/plexamp.desktop install -m 444 -D ${appimageContents}/plexamp.png \ $out/share/icons/hicolor/512x512/apps/plexamp.png - substituteInPlace $out/share/applications/plexamp.desktop \ + substituteInPlace $out/share/applications/${pname}.desktop \ --replace 'Exec=AppRun' 'Exec=${pname}' ''; + passthru.updateScript = ./update-plexamp.sh; + meta = with lib; { - description = "A beautiful Plex music player for audiophiles, curators, and hipsters."; + description = "A beautiful Plex music player for audiophiles, curators, and hipsters"; homepage = "https://plexamp.com/"; + changelog = "https://forums.plex.tv/t/plexamp-release-notes/221280/30"; license = licenses.unfree; - maintainers = with maintainers; [ killercup ]; + maintainers = with maintainers; [ killercup synthetica ]; platforms = [ "x86_64-linux" ]; }; } diff --git a/pkgs/applications/audio/plexamp/update-plexamp.sh b/pkgs/applications/audio/plexamp/update-plexamp.sh new file mode 100755 index 00000000000..b6b8def1e31 --- /dev/null +++ b/pkgs/applications/audio/plexamp/update-plexamp.sh @@ -0,0 +1,54 @@ +#! /usr/bin/env nix-shell +#! nix-shell -p yq bash curl bc ripgrep +#! nix-shell -i bash + +set -Eeuxo pipefail + +cleanup() { + rm -rf "$TMPDIR" +} + +trap cleanup EXIT + +ROOT="$(dirname "$(readlink -f "$0")")" +if [ ! -f "$ROOT/default.nix" ]; then + echo "ERROR: cannot find default.nix in $ROOT" + exit 1 +fi + +if [ "$(basename "$ROOT")" != plexamp ]; then + echo "ERROR: folder not named plexamp" + exit 1 +fi + +TMPDIR="$(mktemp -d)" + +VERSION_FILE="$TMPDIR/version.yml" +VERSION_URL="https://plexamp.plex.tv/plexamp.plex.tv/desktop/latest-linux.yml" +curl "$VERSION_URL" -o "$VERSION_FILE" + +VERSION="$(yq -r .version "$VERSION_FILE")" +SHA512="$(yq -r .sha512 "$VERSION_FILE")" + +DEFAULT_NIX="$ROOT/default.nix" +WORKING_NIX="$TMPDIR/default.nix" +cp "$DEFAULT_NIX" "$WORKING_NIX" + +sed -i "s@version = .*;@version = \"$VERSION\";@g" "$WORKING_NIX" + +if diff "$DEFAULT_NIX" "$WORKING_NIX"; then + echo "WARNING: no changes" + exit 0 +fi + +# update sha hash (convenietly provided) +sed -i "s@sha.* = .*;@sha512 = \"$SHA512\";@g" "$WORKING_NIX" + +# update the changelog ("just" increment the number) +CHANGELOG_URL=$(rg --only-matching 'changelog = "(.+)";' --replace '$1' $WORKING_NIX) +CHANGELOG_NUMBER=$(rg --only-matching '.*/([0-9]+)' --replace '$1' <<< $CHANGELOG_URL) +NEXT_CHANGELOG=$(($CHANGELOG_NUMBER + 1)) +NEXT_URL=$(rg --only-matching '(.*)/[0-9]+' --replace "\$1/$NEXT_CHANGELOG" <<< $CHANGELOG_URL) +sed -i "s@changelog = \".*\";@changelog = \"$NEXT_URL\";@" $WORKING_NIX + +mv $WORKING_NIX $DEFAULT_NIX |