plex-pass: update and fix update script

This commit is contained in:
Luke Granger-Brown 2023-01-08 05:44:03 +00:00
parent 89a9edad15
commit e5a01e31ba
2 changed files with 17 additions and 10 deletions

View file

@ -4,10 +4,10 @@
{ pkgs, ... }:
let
version = "1.29.0.6244-819d3678c";
version = "1.30.1.6497-5fc2e0894";
src = pkgs.fetchurl {
url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb";
hash = "sha256-iGMO6uuNm2c7UBZvA5dYaSxUrEQCL1tR9zLA3rZhBn4=";
url = "https://downloads.plex.tv/plex-media-server-new/1.30.1.6497-5fc2e0894/debian/plexmediaserver_1.30.1.6497-5fc2e0894_amd64.deb";
hash = "sha256:019yyyn24nsn33fvrbg2mqhjp4n710pjdj32xcnlmpq3j6s9w1jp";
};
in
(pkgs.plex.override {

View file

@ -3,12 +3,13 @@
#
# SPDX-License-Identifier: Apache-2.0
VERSION_JSON_URL="https://plex.tv/pms/downloads/5.json?channel=plexpass&X-Plex-Token=$(vault kv get -field=token kv/apps/plex-pass)"
[ -z "$PLEX_PASS_TOKEN" ] && PLEX_PASS_TOKEN="$(vault kv get -field=token kv/apps/plex-pass)"
VERSION_JSON_URL="https://plex.tv/pms/downloads/5.json?channel=plexpass&X-Plex-Token=${PLEX_PASS_TOKEN}"
alias jq="nix run depot.pkgs.jq -c jq"
VERSION_JSON="$(curl "$VERSION_JSON_URL")"
VERSION="$(jq -r '.computer.Linux.version' <<< "$VERSION_JSON")"
RELEASE_JSON="$(jq '.computer.Linux.releases[] | select(.build == "linux-x86_64" and .distro == "redhat")' <<< "$VERSION_JSON")"
RELEASE_JSON="$(jq '.computer.Linux.releases[] | select(.build == "linux-x86_64" and .distro == "debian")' <<< "$VERSION_JSON")"
URL="$(jq -r '.url' <<< "$RELEASE_JSON")"
URL_HASH="$(nix-prefetch-url "$URL")"
@ -18,13 +19,19 @@ cat <<EOF
# SPDX-License-Identifier: Apache-2.0
{ pkgs, ... }:
let
version = "${VERSION}";
src = pkgs.fetchurl {
url = "${URL}";
hash = "sha256:${URL_HASH}";
};
in
(pkgs.plex.override {
plexRaw = (pkgs.plexRaw.overrideAttrs (oldAttrs: rec {
version = "${VERSION}";
src = pkgs.fetchurl {
url = "${URL}";
sha256 = "${URL_HASH}";
};
inherit version src;
}));
}).overrideAttrs (oldAttrs: {
name = "plexmediaserver-\${version}";
inherit version src;
})
EOF