35 pname = "plex-desktop";
39 homepage = "https://plex.tv/";
40 description = "Streaming media player for Plex";
42 Plex for Linux is your client for playback on the Linux
43 desktop. It features the point and click interface you see in your browser
44 but uses a more powerful playback engine as well as
45 some other advance features.
47 maintainers = with lib.maintainers; [ detroyejr ];
48 license = lib.licenses.unfree;
49 platforms = [ "x86_64-linux" ];
50 mainProgram = "plex-desktop";
53 # The latest unstable version isn't compatible with libraries that ship in the snap.
54 libglvnd-1_4_0 = libglvnd.overrideAttrs {
55 src = fetchFromGitLab {
56 domain = "gitlab.freedesktop.org";
60 sha256 = "sha256-Y6JHRygXcZtnrdnqi1Lzyvh/635gwZWnMeW9aRCpxxs";
63 plex-desktop = stdenv.mkDerivation {
64 inherit pname version meta;
67 url = "https://api.snapcraft.io/api/v1/snaps/download/qc6MFRM433ZhI1XjVzErdHivhSOhlpf0_${rev}.snap";
68 hash = "sha512-3ofO4a8HDWeUfjsv+4A5bC0jlQwxIew1CnL39Oa0bjnqShwRQjMW1vSHOjsJ1AHMkbp3h5W/2tFRxPL2C/Heqg==";
71 nativeBuildInputs = [ squashfsTools ];
106 dontWrapQtApps = true;
113 ln -s ${libedit}/lib/libedit.so.0 $out/lib/libedit.so.2
114 rm $out/usr/lib/x86_64-linux-gnu/libasound.so.2
115 ln -s ${alsa-lib}/lib/libasound.so.2 $out/usr/lib/x86_64-linux-gnu/libasound.so.2
116 rm $out/usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
117 ln -s ${alsa-lib}/lib/libasound.so.2.0.0 $out/usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
124 inherit pname version meta;
125 targetPkgs = pkgs: [ xkeyboard_config ];
127 extraInstallCommands = ''
128 mkdir -p $out/share/applications $out/share/icons/hicolor/scalable/apps
129 install -m 444 -D ${plex-desktop}/meta/gui/plex-desktop.desktop $out/share/applications/plex-desktop.desktop
130 substituteInPlace $out/share/applications/plex-desktop.desktop \
132 'Icon=''${SNAP}/meta/gui/icon.png' \
133 'Icon=${plex-desktop}/meta/gui/icon.png' \
135 'Exec=plex-desktop' \
136 'Exec=plex-desktop-${version}'
139 runScript = writeShellScript "plex-desktop.sh" ''
140 # Widevine won't download unless this directory exists.
141 mkdir -p $HOME/.cache/plex/
142 PLEX_USR_PATH=${lib.makeSearchPath "usr/lib/x86_64-linux-gnu" [ plex-desktop ]}
146 lib.makeLibraryPath [
151 LIBGL_DRIVERS_PATH=$PLEX_USR_PATH/dri
152 ${lib.toShellVars extraEnv}
153 exec ${plex-desktop}/Plex.sh
155 passthru.updateScript = ./update.sh;