34 pname = "plex-desktop";
38 homepage = "https://plex.tv/";
39 description = "Streaming media player for Plex";
41 Plex for Linux is your client for playback on the Linux
42 desktop. It features the point and click interface you see in your browser
43 but uses a more powerful playback engine as well as
44 some other advance features.
46 maintainers = with lib.maintainers; [ detroyejr ];
47 license = lib.licenses.unfree;
48 platforms = [ "x86_64-linux" ];
49 mainProgram = "plex-desktop";
52 # The latest unstable version isn't compatible with libraries that ship in the snap.
53 libglvnd-1_4_0 = libglvnd.overrideAttrs {
54 src = fetchFromGitLab {
55 domain = "gitlab.freedesktop.org";
59 sha256 = "sha256-Y6JHRygXcZtnrdnqi1Lzyvh/635gwZWnMeW9aRCpxxs";
62 plex-desktop = stdenv.mkDerivation {
63 inherit pname version meta;
66 url = "https://api.snapcraft.io/api/v1/snaps/download/qc6MFRM433ZhI1XjVzErdHivhSOhlpf0_${rev}.snap";
67 hash = "sha512-rECc8rK1ENAL5mXdabO8ynudCaSzz0yygOyg4gMbCtddgqwSOanP24/oguzPLr3zdRMC3VSf9B3hr2BGQ54tzg==";
70 nativeBuildInputs = [ squashfsTools ];
105 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 name = "${pname}-${version}";
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 ]}
145 LD_LIBRARY_PATH=${lib.makeLibraryPath [ plex-desktop libglvnd-1_4_0 ]}:$PLEX_USR_PATH
146 LIBGL_DRIVERS_PATH=$PLEX_USR_PATH/dri
147 ${lib.toShellVars extraEnv}
148 exec ${plex-desktop}/Plex.sh