Unverified Commit 44f2cd26 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

plex-media-player: drop (#400667)

parents 7b0bae21 3ab8e582
Loading
Loading
Loading
Loading
+0 −88
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  fetchurl,
  pkg-config,
  cmake,
  python3,
  mkDerivation,
  libX11,
  libXrandr,
  qtbase,
  qtwebchannel,
  qtwebengine,
  qtx11extras,
  libvdpau,
  SDL2,
  mpv,
  libGL,
}:
let
  # During compilation, a CMake bundle is downloaded from `artifacts.plex.tv`,
  # which then downloads a handful of web client-related files. To enable
  # sandboxed builds, we manually download them and save them so these files
  # are fetched ahead-of-time instead of during the CMake build. To update
  # plex-media-player use the update.sh script, so the versions and hashes
  # for these files are also updated!
  depSrcs = import ./deps.nix { inherit fetchurl; };
in
mkDerivation rec {
  pname = "plex-media-player";
  version = "2.58.1";
  vsnHash = "ae73e074";

  src = fetchFromGitHub {
    owner = "plexinc";
    repo = "plex-media-player";
    rev = "v${version}-${vsnHash}";
    sha256 = "1q20fdp5d0blb0q6p2357bwdc2g65cadkgdp4w533ij2nyaxydjd";
  };

  nativeBuildInputs = [
    pkg-config
    cmake
    python3
  ];
  buildInputs = [
    libX11
    libXrandr
    qtbase
    qtwebchannel
    qtwebengine
    qtx11extras
    libvdpau
    SDL2
    mpv
    libGL
  ];

  preConfigure = with depSrcs; ''
    mkdir -p build/dependencies
    ln -s ${webClient} build/dependencies/buildid-${webClientBuildId}.cmake
    ln -s ${webClientDesktopHash} build/dependencies/web-client-desktop-${webClientDesktopBuildId}.tar.xz.sha1
    ln -s ${webClientDesktop} build/dependencies/web-client-desktop-${webClientDesktopBuildId}.tar.xz
    ln -s ${webClientTvHash} build/dependencies/web-client-tv-${webClientTvBuildId}.tar.xz.sha1
    ln -s ${webClientTv} build/dependencies/web-client-tv-${webClientTvBuildId}.tar.xz
  '';

  cmakeBuildType = "RelWithDebInfo";

  cmakeFlags = [ "-DQTROOT=${qtbase}" ];

  # plexmediaplayer currently segfaults under wayland
  qtWrapperArgs = [
    "--set"
    "QT_QPA_PLATFORM"
    "xcb"
  ];

  passthru.updateScript = ./update.sh;

  meta = with lib; {
    description = "Streaming media player for Plex";
    license = licenses.gpl2;
    maintainers = with maintainers; [ b4dm4n ];
    homepage = "https://plex.tv";
    mainProgram = "plexmediaplayer";
  };
}
+0 −28
Original line number Diff line number Diff line
{ fetchurl }:

rec {
  webClientBuildId = "183-045db5be50e175";
  webClientDesktopBuildId = "4.29.2-e50e175";
  webClientTvBuildId = "4.29.6-045db5b";

  webClient = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/buildid.cmake";
    sha256 = "1xsacy1xb8a9rfdrd7lvx7n3hd0cf2c3mgmg9wl18jvwnqxyac83";
  };
  webClientDesktopHash = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/web-client-desktop-${webClientDesktopBuildId}.tar.xz.sha1";
    sha256 = "07spxyhrg45ppa2zjn3ri4qvi6qimlmq6wmh492r3jkrwd71rxgf";
  };
  webClientDesktop = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/web-client-desktop-${webClientDesktopBuildId}.tar.xz";
    sha256 = "1zll79hpgx8fghx228li9qairfd637yf8rhvjzdgpq4dvn21fv65";
  };
  webClientTvHash = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/web-client-tv-${webClientTvBuildId}.tar.xz.sha1";
    sha256 = "1zzfw2g76wqrxrx9kck5q79if78z91wn3awj703kz9sgxi4bkjsk";
  };
  webClientTv = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/web-client-tv-${webClientTvBuildId}.tar.xz";
    sha256 = "1f1zvrr3c0w37gvl78blg9rgxxi64nc4iv5vd87qbysfh1vpsjz0";
  };
}
+0 −71
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts nix-prefetch-scripts jq

set -xeuo pipefail

nixpkgs="$(git rev-parse --show-toplevel)"

oldVersion="$(nix-instantiate --eval -E "with import $nixpkgs {}; plex-media-player.version or (builtins.parseDrvName plex-media-player.name).version" | tr -d '"')"
latestTag="$(curl -s https://api.github.com/repos/plexinc/plex-media-player/tags  | jq -r '.[] | .name' | sort --version-sort | tail -1)"
latestVersion="$(expr $latestTag : 'v\(.*\)-.*')"
latestHash="$(expr $latestTag : 'v.*-\(.*\)')"

if [ ! "$oldVersion" = "$latestVersion" ]; then
  # update default.nix with the new version and hash
  expectedHash=$(nix-prefetch-git --url https://github.com/plexinc/plex-media-player.git --rev $latestTag --quiet | jq -r '.sha256')
  update-source-version plex-media-player --version-key=vsnHash "${latestHash}" 0000
  update-source-version plex-media-player "${latestVersion}" $expectedHash

  # extract the webClientBuildId from the source folder
  src="$(nix-build --no-out-link $nixpkgs -A plex-media-player.src)"
  webClientBuildId="$(grep 'set(WEB_CLIENT_BUILD_ID' $src/CMakeModules/WebClient.cmake | cut -d' ' -f2 | tr -d ')')"

  # retreive the included cmake file and hash
  { read -r webClientBuildIdHash; read -r webClientBuildIdPath; } < \
    <(nix-prefetch-url --print-path "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/buildid.cmake")
  webClientDesktopBuildId="$(grep 'set(DESKTOP_VERSION' $webClientBuildIdPath | cut -d' ' -f2 | tr -d ')')"
  webClientTvBuildId="$(grep 'set(TV_VERSION' $webClientBuildIdPath | cut -d' ' -f2 | tr -d ')')"

  # get the hashes for the other files
  webClientDesktopHash="$(nix-prefetch-url "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/web-client-desktop-${webClientDesktopBuildId}.tar.xz.sha1")"
  webClientDesktop="$(nix-prefetch-url "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/web-client-desktop-${webClientDesktopBuildId}.tar.xz")"
  webClientTvHash="$(nix-prefetch-url "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/web-client-tv-${webClientTvBuildId}.tar.xz.sha1")"
  webClientTv="$(nix-prefetch-url "https://artifacts.plex.tv/web-client-pmp/${webClientBuildId}/web-client-tv-${webClientTvBuildId}.tar.xz")"

  # update deps.nix
  cat > $nixpkgs/pkgs/applications/video/plex-media-player/deps.nix <<EOF
{ fetchurl }:

rec {
  webClientBuildId = "${webClientBuildId}";
  webClientDesktopBuildId = "${webClientDesktopBuildId}";
  webClientTvBuildId = "${webClientTvBuildId}";

  webClient = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/\${webClientBuildId}/buildid.cmake";
    sha256 = "${webClientBuildIdHash}";
  };
  webClientDesktopHash = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/\${webClientBuildId}/web-client-desktop-\${webClientDesktopBuildId}.tar.xz.sha1";
    sha256 = "${webClientDesktopHash}";
  };
  webClientDesktop = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/\${webClientBuildId}/web-client-desktop-\${webClientDesktopBuildId}.tar.xz";
    sha256 = "${webClientDesktop}";
  };
  webClientTvHash = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/\${webClientBuildId}/web-client-tv-\${webClientTvBuildId}.tar.xz.sha1";
    sha256 = "${webClientTvHash}";
  };
  webClientTv = fetchurl {
    url = "https://artifacts.plex.tv/web-client-pmp/\${webClientBuildId}/web-client-tv-\${webClientTvBuildId}.tar.xz";
    sha256 = "${webClientTv}";
  };
}
EOF

  git add "$nixpkgs"/pkgs/applications/video/plex-media-player/{default,deps}.nix
  git commit -m "plex-media-player: ${oldVersion} -> ${latestVersion}"
else
  echo "plex-media-player is already up-to-date"
fi
+1 −0
Original line number Diff line number Diff line
@@ -1504,6 +1504,7 @@ mapAliases {
  pipewire-media-session = throw "pipewire-media-session is no longer maintained and has been removed. Please use Wireplumber instead.";
  platypus = throw "platypus is unmaintained and has not merged Python3 support"; # Added 2025-03-20
  pleroma-otp = throw "'pleroma-otp' has been renamed to/replaced by 'pleroma'"; # Converted to throw 2024-10-17
  plex-media-player = throw "'plex-media-player' has been discontinued, the new official client is available as 'plex-desktop'"; # Added 2025-05-28
  plots = throw "'plots' has been replaced by 'gnome-graphs'"; # Added 2025-02-05
  pltScheme = racket; # just to be sure
  poac = cabinpkg; # Added 2025-01-22
+0 −2
Original line number Diff line number Diff line
@@ -13691,8 +13691,6 @@ with pkgs;
  plexamp = callPackage ../applications/audio/plexamp { };
  plex-media-player = libsForQt5.callPackage ../applications/video/plex-media-player { };
  plex-mpv-shim = python3Packages.callPackage ../applications/video/plex-mpv-shim { };
  plover = recurseIntoAttrs (libsForQt5.callPackage ../applications/misc/plover { });