1{
2 lib,
3 buildPythonApplication,
4 fetchFromGitHub,
5 fetchpatch,
6 python,
7 mpv,
8 requests,
9 python-mpv-jsonipc,
10 pystray,
11 tkinter,
12 wrapGAppsHook3,
13 gobject-introspection,
14 mpv-shim-default-shaders,
15}:
16
17buildPythonApplication rec {
18 pname = "plex-mpv-shim";
19 version = "1.11.0";
20 format = "setuptools";
21
22 src = fetchFromGitHub {
23 owner = "iwalton3";
24 repo = pname;
25 tag = "v${version}";
26 sha256 = "sha256-hUGKOJEDZMK5uhHoevFt1ay6QQEcoN4F8cPxln5uMRo=";
27 };
28
29 patches = [
30 # pull in upstream commit to fix python-mpv dependency name -- remove when version > 1.11.0
31 (fetchpatch {
32 url = "https://github.com/iwalton3/plex-mpv-shim/commit/d8643123a8ec79216e02850b08f63b06e4e0a2ea.diff";
33 hash = "sha256-nc+vwYnAtMjVzL2fIQeTAqhf3HBseL+2pFEtv8zNUXo=";
34 })
35 ];
36
37 nativeBuildInputs = [
38 wrapGAppsHook3
39 gobject-introspection
40 ];
41
42 propagatedBuildInputs = [
43 mpv
44 requests
45 python-mpv-jsonipc
46 pystray
47 tkinter
48 ];
49
50 # needed for pystray to access appindicator using GI
51 preFixup = ''
52 makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
53 '';
54 dontWrapGApps = true;
55
56 postInstall = ''
57 # put link to shaders where upstream package expects them
58 ln -s ${mpv-shim-default-shaders}/share/mpv-shim-default-shaders $out/${python.sitePackages}/plex_mpv_shim/default_shader_pack
59 '';
60
61 # does not contain tests
62 doCheck = false;
63
64 meta = with lib; {
65 homepage = "https://github.com/iwalton3/plex-mpv-shim";
66 description = "Allows casting of videos to MPV via the Plex mobile and web app";
67 maintainers = with maintainers; [ devusb ];
68 license = licenses.mit;
69 platforms = platforms.linux;
70 mainProgram = "plex-mpv-shim";
71 };
72}