about summary refs log tree commit diff
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2021-03-18 20:22:21 -0400
committerGitHub <noreply@github.com>2021-03-18 20:22:21 -0400
commit67272ac8fa32bfbb0ba04228ef44ca5d0e4e5af0 (patch)
tree8bdbb281862a6fc3a9bb41ce71deccb102f9e9b6 /pkgs/applications/video
parent296c47d7b225445adeda4cad61a2031180099a75 (diff)
parent2d9ac443208ae5733fb9cb5b0eaa27e4a4c7c0fa (diff)
Merge pull request #116493 from aanderse/kodi-wip
kodi.packages: refactor, netflix: init at 1.14.1
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/kodi-packages/addon-update-script/default.nix23
-rw-r--r--pkgs/applications/video/kodi-packages/certifi/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/chardet/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/controllers/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/idna/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/inputstream-adaptive/default.nix28
-rw-r--r--pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/joystick/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/kodi-platform/default.nix15
-rw-r--r--pkgs/applications/video/kodi-packages/myconnpy/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/netflix/default.nix26
-rw-r--r--pkgs/applications/video/kodi-packages/osmc-skin/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/pdfreader/default.nix19
-rw-r--r--pkgs/applications/video/kodi-packages/pvr-hdhomerun/default.nix22
-rw-r--r--pkgs/applications/video/kodi-packages/pvr-hts/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/pvr-iptvsimple/default.nix22
-rw-r--r--pkgs/applications/video/kodi-packages/requests/default.nix28
-rw-r--r--pkgs/applications/video/kodi-packages/signals/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/steam-controller/default.nix22
-rw-r--r--pkgs/applications/video/kodi-packages/steam-launcher/default.nix28
-rw-r--r--pkgs/applications/video/kodi-packages/svtplay/default.nix26
-rw-r--r--pkgs/applications/video/kodi-packages/urllib3/default.nix21
-rw-r--r--pkgs/applications/video/kodi-packages/vfs-libarchive/default.nix22
-rw-r--r--pkgs/applications/video/kodi-packages/vfs-sftp/default.nix22
-rw-r--r--pkgs/applications/video/kodi/build-kodi-addon.nix21
-rw-r--r--pkgs/applications/video/kodi/build-kodi-binary-addon.nix31
-rw-r--r--pkgs/applications/video/kodi/default.nix2
-rw-r--r--pkgs/applications/video/kodi/packages.nix560
-rw-r--r--pkgs/applications/video/kodi/wrapper.nix7
-rw-r--r--pkgs/applications/video/kodi/yatp/dont-monkey.patch29
30 files changed, 593 insertions, 591 deletions
diff --git a/pkgs/applications/video/kodi-packages/addon-update-script/default.nix b/pkgs/applications/video/kodi-packages/addon-update-script/default.nix
new file mode 100644
index 0000000000000..17c1d45783fa0
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/addon-update-script/default.nix
@@ -0,0 +1,23 @@
+{ writeShellScript
+, nix
+, curl
+, gzip
+, xmlstarlet
+, common-updater-scripts
+}:
+
+{ attrPath }:
+
+let
+  url = "http://mirrors.kodi.tv/addons/matrix/addons.xml.gz";
+  updateScript = writeShellScript "update.sh" ''
+    set -ex
+
+    attrPath=$1
+    namespace=$(${nix}/bin/nix-instantiate $systemArg --eval -E "with import ./. {}; $attrPath.namespace" | tr -d '"')
+    version=$(${curl}/bin/curl -s -L ${url} | ${gzip}/bin/gunzip -c | ${xmlstarlet}/bin/xml select -T -t -m "//addons/addon[@id='$namespace']" -v @version)
+
+    ${common-updater-scripts}/bin/update-source-version "$attrPath" "$version"
+  '';
+in
+  [ updateScript attrPath ]
diff --git a/pkgs/applications/video/kodi-packages/certifi/default.nix b/pkgs/applications/video/kodi-packages/certifi/default.nix
new file mode 100644
index 0000000000000..bfce47b7b2ce2
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/certifi/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
+buildKodiAddon rec {
+  pname = "certifi";
+  namespace = "script.module.certifi";
+  version = "2019.11.28+matrix.1";
+
+  src = fetchzip {
+    url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip";
+    sha256 = "0vsd68izv1ix0hb1gm74qq3zff0sxmhfhjyh7y9005zzp2gpi62v";
+  };
+
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.certifi";
+  };
+
+  meta = with lib; {
+    homepage = "https://certifi.io";
+    description = "Python package for providing Mozilla's CA Bundle";
+    license = licenses.mpl20;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/chardet/default.nix b/pkgs/applications/video/kodi-packages/chardet/default.nix
new file mode 100644
index 0000000000000..1e37f6b46e2b0
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/chardet/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
+buildKodiAddon rec {
+  pname = "chardet";
+  namespace = "script.module.chardet";
+  version = "3.0.4+matrix.3";
+
+  src = fetchzip {
+    url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip";
+    sha256 = "05928dj4fsj2zg8ajdial3sdf8izddq64sr0al3zy1gqw91jp80f";
+  };
+
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.chardet";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/Freso/script.module.chardet";
+    description = "Universal encoding detector";
+    license = licenses.lgpl2Only;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/controllers/default.nix b/pkgs/applications/video/kodi-packages/controllers/default.nix
new file mode 100644
index 0000000000000..bd29b7c0f7c30
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/controllers/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchFromGitHub, controller }:
+buildKodiAddon rec {
+  pname = "game-controller-${controller}";
+  namespace = "game.controller.${controller}";
+  version = "1.0.3";
+
+  sourceDir = "addons/" + namespace;
+
+  src = fetchFromGitHub {
+    owner = "kodi-game";
+    repo = "kodi-game-controllers";
+    rev = "01acb5b6e8b85392b3cb298b034aadb1b24ccf18";
+    sha256 = "0sbc0w0fwbp7rbmbgb6a1kglhnn5g85hijcbbvf5x6jdq9v3f1qb";
+  };
+
+  meta = with lib; {
+    description = "Add support for different gaming controllers.";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ edwtjo ];
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/idna/default.nix b/pkgs/applications/video/kodi-packages/idna/default.nix
new file mode 100644
index 0000000000000..abe5635e8281d
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/idna/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
+buildKodiAddon rec {
+  pname = "idna";
+  namespace = "script.module.idna";
+  version = "2.8.1+matrix.1";
+
+  src = fetchzip {
+    url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip";
+    sha256 = "02s75fhfmbs3a38wvxba51aj3lv5bidshjdkl6yjfji6waxpr9xh";
+  };
+
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.idna";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/Freso/script.module.idna";
+    description = "Internationalized Domain Names for Python";
+    license = licenses.bsd3;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/inputstream-adaptive/default.nix b/pkgs/applications/video/kodi-packages/inputstream-adaptive/default.nix
new file mode 100644
index 0000000000000..cd4c5aca11716
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/inputstream-adaptive/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, lib, rel, addonDir, buildKodiBinaryAddon, fetchFromGitHub, expat, glib, nspr, nss }:
+buildKodiBinaryAddon rec {
+  pname = "inputstream-adaptive";
+  namespace = "inputstream.adaptive";
+  version = "2.6.7";
+
+  src = fetchFromGitHub {
+    owner = "peak3d";
+    repo = "inputstream.adaptive";
+    rev = "${version}-${rel}";
+    sha256 = "1pwqmbr78wp12jn6rwv63npdfc456adwz0amlxf6gvgg43li6p7s";
+  };
+
+  extraBuildInputs = [ expat ];
+
+  extraRuntimeDependencies = [ glib nspr nss stdenv.cc.cc.lib ];
+
+  extraInstallPhase = let n = namespace; in ''
+    ln -s $out/lib/addons/${n}/libssd_wv.so $out/${addonDir}/${n}/libssd_wv.so
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/peak3d/inputstream.adaptive";
+    description = "Kodi inputstream addon for several manifest types";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ sephalon ];
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix b/pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix
new file mode 100644
index 0000000000000..2bbcc6d9d2c3f
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/inputstreamhelper/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
+buildKodiAddon rec {
+  pname = "inputstreamhelper";
+  namespace = "script.module.inputstreamhelper";
+  version = "0.5.2+matrix.1";
+
+  src = fetchzip {
+    url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip";
+    sha256 = "18lkksljfa57w69yklbldf7dgyykrm84pd10mdjdqdm88fdiiijk";
+  };
+
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.inputstreamhelper";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/emilsvennesson/script.module.inputstreamhelper";
+    description = "A simple Kodi module that makes life easier for add-on developers relying on InputStream based add-ons and DRM playback";
+    license = licenses.mit;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/joystick/default.nix b/pkgs/applications/video/kodi-packages/joystick/default.nix
new file mode 100644
index 0000000000000..321ddce905fd3
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/joystick/default.nix
@@ -0,0 +1,21 @@
+{ lib, rel, buildKodiBinaryAddon, fetchFromGitHub, tinyxml, udev }:
+buildKodiBinaryAddon rec {
+  pname = namespace;
+  namespace = "peripheral.joystick";
+  version = "1.7.1";
+
+  src = fetchFromGitHub {
+    owner = "xbmc";
+    repo = namespace;
+    rev = "${version}-${rel}";
+    sha256 = "1dhj4afr9kj938xx70fq5r409mz6lbw4n581ljvdjj9lq7akc914";
+  };
+
+  meta = with lib; {
+    description = "Binary addon for raw joystick input.";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ edwtjo ];
+  };
+
+  extraBuildInputs = [ tinyxml udev ];
+}
diff --git a/pkgs/applications/video/kodi-packages/kodi-platform/default.nix b/pkgs/applications/video/kodi-packages/kodi-platform/default.nix
new file mode 100644
index 0000000000000..6d458f7377d72
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/kodi-platform/default.nix
@@ -0,0 +1,15 @@
+{ stdenv, fetchFromGitHub, cmake, kodi, libcec_platform, tinyxml }:
+stdenv.mkDerivation rec {
+  pname = "kodi-platform";
+  version = "17.1";
+
+  src = fetchFromGitHub {
+    owner = "xbmc";
+    repo = pname;
+    rev = "c8188d82678fec6b784597db69a68e74ff4986b5";
+    sha256 = "1r3gs3c6zczmm66qcxh9mr306clwb3p7ykzb70r3jv5jqggiz199";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ kodi libcec_platform tinyxml ];
+}
diff --git a/pkgs/applications/video/kodi-packages/myconnpy/default.nix b/pkgs/applications/video/kodi-packages/myconnpy/default.nix
new file mode 100644
index 0000000000000..a1b2557652421
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/myconnpy/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
+buildKodiAddon rec {
+  pname = "myconnpy";
+  namespace = "script.module.myconnpy";
+  version = "8.0.18+matrix.1";
+
+  src = fetchzip {
+    url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip";
+    sha256 = "1cx3qdzw9lkkmbyvyrmc2i193is20fihn2sfl7kmv43f708vam0k";
+  };
+
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.myconnpy";
+  };
+
+  meta = with lib; {
+    homepage = "http://dev.mysql.com/doc/connector-python/en/index.html";
+    description = "MySQL Connector/Python";
+    license = licenses.gpl2Only;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/netflix/default.nix b/pkgs/applications/video/kodi-packages/netflix/default.nix
new file mode 100644
index 0000000000000..20440153f76ec
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/netflix/default.nix
@@ -0,0 +1,26 @@
+{ lib, buildKodiAddon, fetchFromGitHub, signals, inputstreamhelper, requests, myconnpy }:
+buildKodiAddon rec {
+  pname = "netflix";
+  namespace = "plugin.video.netflix";
+  version = "1.14.1";
+
+  src = fetchFromGitHub {
+    owner = "CastagnaIT";
+    repo = namespace;
+    rev = "v${version}";
+    sha256 = "0vv3234gg4brp0gvrsl4vdskmpfbyk4z7cjmmj31zn4m8j33japn";
+  };
+
+  propagatedBuildInputs = [
+    signals
+    inputstreamhelper
+    requests
+    myconnpy
+  ];
+
+  meta = with lib; {
+    homepage = "https://github.com/CastagnaIT/plugin.video.netflix";
+    description = "Netflix VOD Services Add-on";
+    license = licenses.mit;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/osmc-skin/default.nix b/pkgs/applications/video/kodi-packages/osmc-skin/default.nix
new file mode 100644
index 0000000000000..c83fd66a43331
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/osmc-skin/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchFromGitHub }:
+buildKodiAddon rec {
+  pname = "osmc-skin";
+  namespace = "skin.osmc";
+  version = "18.0.0";
+
+  src = fetchFromGitHub {
+    owner = "osmc";
+    repo = namespace;
+    rev = "40a6c318641e2cbeac58fb0e7dde9c2beac737a0";
+    sha256 = "1l7hyfj5zvjxjdm94y325bmy1naak455b9l8952sb0gllzrcwj6s";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/osmc/skin.osmc";
+    description = "The default skin for OSMC";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ worldofpeace ];
+    license = licenses.cc-by-nc-sa-30;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/pdfreader/default.nix b/pkgs/applications/video/kodi-packages/pdfreader/default.nix
new file mode 100644
index 0000000000000..430b9be3fd45c
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/pdfreader/default.nix
@@ -0,0 +1,19 @@
+{ lib, buildKodiAddon, fetchFromGitHub }:
+buildKodiAddon rec {
+  pname = "pdfreader";
+  namespace = "plugin.image.pdf";
+  version = "2.0.2";
+
+  src = fetchFromGitHub {
+    owner = "i96751414";
+    repo = "plugin.image.pdfreader";
+    rev = "v${version}";
+    sha256 = "0nkqhlm1gyagq6xpdgqvd5qxyr2ngpml9smdmzfabc8b972mwjml";
+  };
+
+  meta = with lib; {
+    homepage = "https://forum.kodi.tv/showthread.php?tid=187421";
+    description = "A comic book reader";
+    maintainers = with maintainers; [ edwtjo ];
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/pvr-hdhomerun/default.nix b/pkgs/applications/video/kodi-packages/pvr-hdhomerun/default.nix
new file mode 100644
index 0000000000000..3920120b90acd
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/pvr-hdhomerun/default.nix
@@ -0,0 +1,22 @@
+{ lib, rel, buildKodiBinaryAddon, fetchFromGitHub, jsoncpp, libhdhomerun }:
+buildKodiBinaryAddon rec {
+  pname = "pvr-hdhomerun";
+  namespace = "pvr.hdhomerun";
+  version = "7.1.0";
+
+  src = fetchFromGitHub {
+    owner = "kodi-pvr";
+    repo = "pvr.hdhomerun";
+    rev = "${version}-${rel}";
+    sha256 = "0gbwjssnd319csq2kwlyjj1rskg19m1dxac5dl2dymvx5hn3zrgm";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/kodi-pvr/pvr.hdhomerun";
+    description = "Kodi's HDHomeRun PVR client addon";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ titanous ];
+  };
+
+  extraBuildInputs = [ jsoncpp libhdhomerun ];
+}
diff --git a/pkgs/applications/video/kodi-packages/pvr-hts/default.nix b/pkgs/applications/video/kodi-packages/pvr-hts/default.nix
new file mode 100644
index 0000000000000..935238758a6be
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/pvr-hts/default.nix
@@ -0,0 +1,21 @@
+{ lib, rel, buildKodiBinaryAddon, fetchFromGitHub }:
+buildKodiBinaryAddon rec {
+  pname = "pvr-hts";
+  namespace = "pvr.hts";
+  version = "8.2.2";
+
+  src = fetchFromGitHub {
+    owner = "kodi-pvr";
+    repo = "pvr.hts";
+    rev = "${version}-${rel}";
+    sha256 = "0jnn9gfjl556acqjf92wzzn371gxymhbbi665nqgg2gjcan0a49q";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/kodi-pvr/pvr.hts";
+    description = "Kodi's Tvheadend HTSP client addon";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ cpages ];
+  };
+
+}
diff --git a/pkgs/applications/video/kodi-packages/pvr-iptvsimple/default.nix b/pkgs/applications/video/kodi-packages/pvr-iptvsimple/default.nix
new file mode 100644
index 0000000000000..b508eae8c7e87
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/pvr-iptvsimple/default.nix
@@ -0,0 +1,22 @@
+{ lib, rel, buildKodiBinaryAddon, fetchFromGitHub, zlib, pugixml }:
+buildKodiBinaryAddon rec {
+  pname = "pvr-iptvsimple";
+  namespace = "pvr.iptvsimple";
+  version = "7.4.2";
+
+  src = fetchFromGitHub {
+    owner = "kodi-pvr";
+    repo = "pvr.iptvsimple";
+    rev = "${version}-${rel}";
+    sha256 = "062i922qi0izkvn7v47yhyy2cf3fa7xc3k95b1gm9abfdwkk8ywr";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/kodi-pvr/pvr.iptvsimple";
+    description = "Kodi's IPTV Simple client addon";
+    platforms = platforms.all;
+    license = licenses.gpl2Plus;
+  };
+
+  extraBuildInputs = [ zlib pugixml ];
+}
diff --git a/pkgs/applications/video/kodi-packages/requests/default.nix b/pkgs/applications/video/kodi-packages/requests/default.nix
new file mode 100644
index 0000000000000..05288b74b6c1b
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/requests/default.nix
@@ -0,0 +1,28 @@
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript, certifi, chardet, idna, urllib3 }:
+buildKodiAddon rec {
+  pname = "requests";
+  namespace = "script.module.requests";
+  version = "2.22.0+matrix.1";
+
+  src = fetchzip {
+    url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip";
+    sha256 = "09576galkyzhw8fhy2h4aablm5rm2v08g0mdmg9nn55dlxhkkljq";
+  };
+
+  propagatedBuildInputs = [
+    certifi
+    chardet
+    idna
+    urllib3
+  ];
+
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.requests";
+  };
+
+  meta = with lib; {
+    homepage = "http://python-requests.org";
+    description = "Python HTTP for Humans";
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/signals/default.nix b/pkgs/applications/video/kodi-packages/signals/default.nix
new file mode 100644
index 0000000000000..9d49e632721fa
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/signals/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
+buildKodiAddon rec {
+  pname = "signals";
+  namespace = "script.module.addon.signals";
+  version = "0.0.6+matrix.1";
+
+  src = fetchzip {
+    url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip";
+    sha256 = "1qcjbakch8hvx02wc01zv014nmzgn6ahc4n2bj5mzr114ppd3hjs";
+  };
+
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.signals";
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/ruuk/script.module.addon.signals";
+    description = "Provides signal/slot mechanism for inter-addon communication";
+    license = licenses.lgpl21Only;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/steam-controller/default.nix b/pkgs/applications/video/kodi-packages/steam-controller/default.nix
new file mode 100644
index 0000000000000..5eee0eff9415a
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/steam-controller/default.nix
@@ -0,0 +1,22 @@
+{ lib, buildKodiBinaryAddon, fetchFromGitHub, libusb1 }:
+buildKodiBinaryAddon rec {
+  pname = namespace;
+  namespace = "peripheral.steamcontroller";
+  version = "0.11.0";
+
+  src = fetchFromGitHub {
+    owner = "kodi-game";
+    repo = namespace;
+    rev = "f68140ca44f163a03d3a625d1f2005a6edef96cb";
+    sha256 = "09lm8i119xlsxxk0c64rnp8iw0crr90v7m8iwi9r31qdmxrdxpmg";
+  };
+
+  extraBuildInputs = [ libusb1 ];
+
+  meta = with lib; {
+    description = "Binary addon for steam controller.";
+    platforms = platforms.all;
+    maintainers = with maintainers; [ edwtjo ];
+  };
+
+}
diff --git a/pkgs/applications/video/kodi-packages/steam-launcher/default.nix b/pkgs/applications/video/kodi-packages/steam-launcher/default.nix
new file mode 100644
index 0000000000000..cb140b4fb4d68
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/steam-launcher/default.nix
@@ -0,0 +1,28 @@
+{ lib, buildKodiAddon, fetchFromGitHub, steam }:
+buildKodiAddon {
+  pname = "steam-launcher";
+  namespace = "script.steam.launcher";
+  version = "3.5.1";
+
+  src = fetchFromGitHub rec {
+    owner = "teeedubb";
+    repo = owner + "-xbmc-repo";
+    rev = "8260bf9b464846a1f1965da495d2f2b7ceb81d55";
+    sha256 = "1fj3ry5s44nf1jzxk4bmnpa4b9p23nrpmpj2a4i6xf94h7jl7p5k";
+  };
+
+  propagatedBuildInputs = [ steam ];
+
+  meta = with lib; {
+    homepage = "https://forum.kodi.tv/showthread.php?tid=157499";
+    description = "Launch Steam in Big Picture Mode from Kodi";
+    longDescription = ''
+      This add-on will close/minimise Kodi, launch Steam in Big
+      Picture Mode and when Steam BPM is exited (either by quitting
+      Steam or returning to the desktop) Kodi will
+      restart/maximise. Running pre/post Steam scripts can be
+      configured via the addon.
+    '';
+    maintainers = with maintainers; [ edwtjo ];
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/svtplay/default.nix b/pkgs/applications/video/kodi-packages/svtplay/default.nix
new file mode 100644
index 0000000000000..cc7d350fa31ca
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/svtplay/default.nix
@@ -0,0 +1,26 @@
+{ lib, buildKodiAddon, fetchFromGitHub }:
+buildKodiAddon rec {
+  pname = "svtplay";
+  namespace = "plugin.video.svtplay";
+  version = "5.1.12";
+
+  src = fetchFromGitHub {
+    owner = "nilzen";
+    repo = "xbmc-" + pname;
+    rev = "v${version}";
+    sha256 = "04j1nhm7mh9chs995lz6bv1vsq5xzk7a7c0lmk4bnfv8jrfpj0w6";
+  };
+
+  meta = with lib; {
+    homepage = "https://forum.kodi.tv/showthread.php?tid=67110";
+    description = "Watch content from SVT Play";
+    longDescription = ''
+      With this addon you can stream content from SVT Play
+      (svtplay.se). The plugin fetches the video URL from the SVT
+      Play website and feeds it to the Kodi video player. HLS (m3u8)
+      is the preferred video format by the plugin.
+    '';
+    platforms = platforms.all;
+    maintainers = with maintainers; [ edwtjo ];
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/urllib3/default.nix b/pkgs/applications/video/kodi-packages/urllib3/default.nix
new file mode 100644
index 0000000000000..e814698791394
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/urllib3/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildKodiAddon, fetchzip, addonUpdateScript }:
+buildKodiAddon rec {
+  pname = "urllib3";
+  namespace = "script.module.urllib3";
+  version = "1.25.8+matrix.1";
+
+  src = fetchzip {
+    url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip";
+    sha256 = "080yq8ns0sag6rmdag1hjwi0whcmp35wzqjp3by92m81cpszs75q";
+  };
+
+  passthru.updateScript = addonUpdateScript {
+    attrPath = "kodi.packages.urllib3";
+  };
+
+  meta = with lib; {
+    homepage = "https://urllib3.readthedocs.io/en/latest/";
+    description = "HTTP library with thread-safe connection pooling, file post, and more";
+    license = licenses.mit;
+  };
+}
diff --git a/pkgs/applications/video/kodi-packages/vfs-libarchive/default.nix b/pkgs/applications/video/kodi-packages/vfs-libarchive/default.nix
new file mode 100644
index 0000000000000..13100b0dd35a7
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/vfs-libarchive/default.nix
@@ -0,0 +1,22 @@
+{ lib, rel, buildKodiBinaryAddon, fetchFromGitHub, libarchive, lzma, bzip2, zlib, lz4, lzo, openssl }:
+buildKodiBinaryAddon rec {
+  pname = namespace;
+  namespace = "vfs.libarchive";
+  version = "2.0.0";
+
+  src = fetchFromGitHub {
+    owner = "xbmc";
+    repo = namespace;
+    rev = "${version}-${rel}";
+    sha256 = "1q62p1i6rvqk2zv6f1cpffkh95lgclys2xl4dwyhj3acmqdxd9i5";
+  };
+
+  meta = with lib; {
+    description = "LibArchive Virtual Filesystem add-on for Kodi";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ minijackson ];
+  };
+
+  extraBuildInputs = [ libarchive lzma bzip2 zlib lz4 lzo openssl ];
+}
diff --git a/pkgs/applications/video/kodi-packages/vfs-sftp/default.nix b/pkgs/applications/video/kodi-packages/vfs-sftp/default.nix
new file mode 100644
index 0000000000000..7910ab640e912
--- /dev/null
+++ b/pkgs/applications/video/kodi-packages/vfs-sftp/default.nix
@@ -0,0 +1,22 @@
+{ lib, rel, buildKodiBinaryAddon, fetchFromGitHub, openssl, libssh, zlib }:
+buildKodiBinaryAddon rec {
+  pname = namespace;
+  namespace = "vfs.sftp";
+  version = "2.0.0";
+
+  src = fetchFromGitHub {
+    owner = "xbmc";
+    repo = namespace;
+    rev = "${version}-${rel}";
+    sha256 = "06w74sh8yagrrp7a7rjaz3xrh1j3wdqald9c4b72c33gpk5997dk";
+  };
+
+  meta = with lib; {
+    description = "SFTP Virtual Filesystem add-on for Kodi";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ minijackson ];
+  };
+
+  extraBuildInputs = [ openssl libssh zlib ];
+}
diff --git a/pkgs/applications/video/kodi/build-kodi-addon.nix b/pkgs/applications/video/kodi/build-kodi-addon.nix
new file mode 100644
index 0000000000000..cd768b6fa9919
--- /dev/null
+++ b/pkgs/applications/video/kodi/build-kodi-addon.nix
@@ -0,0 +1,21 @@
+{ stdenv, toKodiAddon, addonDir }:
+{ name ? "${attrs.pname}-${attrs.version}"
+, namespace
+, sourceDir ? ""
+, ... } @ attrs:
+toKodiAddon (stdenv.mkDerivation ({
+  name = "kodi-" + name;
+
+  dontStrip = true;
+
+  extraRuntimeDependencies = [ ];
+
+  installPhase = ''
+    cd $src/$sourceDir
+    d=$out${addonDir}/${namespace}
+    mkdir -p $d
+    sauce="."
+    [ -d ${namespace} ] && sauce=${namespace}
+    cp -R "$sauce/"* $d
+  '';
+} // attrs))
diff --git a/pkgs/applications/video/kodi/build-kodi-binary-addon.nix b/pkgs/applications/video/kodi/build-kodi-binary-addon.nix
new file mode 100644
index 0000000000000..74ce508ab6a60
--- /dev/null
+++ b/pkgs/applications/video/kodi/build-kodi-binary-addon.nix
@@ -0,0 +1,31 @@
+{ stdenv, toKodiAddon, addonDir, cmake, kodi, kodi-platform, libcec_platform }:
+{ name ? "${attrs.pname}-${attrs.version}"
+, namespace
+, version
+, extraBuildInputs ? []
+, extraRuntimeDependencies ? []
+, extraInstallPhase ? "", ... } @ attrs:
+toKodiAddon (stdenv.mkDerivation ({
+  name = "kodi-" + name;
+
+  dontStrip = true;
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ kodi kodi-platform libcec_platform ] ++ extraBuildInputs;
+
+  inherit extraRuntimeDependencies;
+
+  # disables check ensuring install prefix is that of kodi
+  cmakeFlags = [
+    "-DOVERRIDE_PATHS=1"
+  ];
+
+  # kodi checks for addon .so libs existance in the addon folder (share/...)
+  # and the non-wrapped kodi lib/... folder before even trying to dlopen
+  # them. Symlinking .so, as setting LD_LIBRARY_PATH is of no use
+  installPhase = let n = namespace; in ''
+    make install
+    ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version}
+    ${extraInstallPhase}
+  '';
+} // attrs))
diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/default.nix
index 55ba84cc454c1..3f382efff11b9 100644
--- a/pkgs/applications/video/kodi/default.nix
+++ b/pkgs/applications/video/kodi/default.nix
@@ -1,7 +1,7 @@
 { callPackage, ... } @ args:
 let
   unwrapped = callPackage ./unwrapped.nix (removeAttrs args [ "callPackage" ]);
-  kodiPackages = callPackage ./packages.nix { kodi = unwrapped; };
+  kodiPackages = callPackage ../../../top-level/kodi-packages.nix { kodi = unwrapped; };
 in
   unwrapped.overrideAttrs (oldAttrs: {
     passthru = oldAttrs.passthru // {
diff --git a/pkgs/applications/video/kodi/packages.nix b/pkgs/applications/video/kodi/packages.nix
deleted file mode 100644
index 8e0ecbf9b9b71..0000000000000
--- a/pkgs/applications/video/kodi/packages.nix
+++ /dev/null
@@ -1,560 +0,0 @@
-{ lib, stdenv, callPackage, fetchFromGitHub
-, cmake, kodi, libcec_platform, tinyxml, pugixml
-, steam, udev, libusb1, jsoncpp, libhdhomerun, zlib
-, python3Packages, expat, glib, nspr, nss, openssl
-, libssh, libarchive, lzma, bzip2, lz4, lzo }:
-
-with lib;
-
-let self = rec {
-
-  addonDir = "/share/kodi/addons";
-  rel = "Matrix";
-
-  inherit kodi;
-
-  # Convert derivation to a kodi module. Stolen from ../../../top-level/python-packages.nix
-  toKodiAddon = drv: drv.overrideAttrs(oldAttrs: {
-    # Use passthru in order to prevent rebuilds when possible.
-    passthru = (oldAttrs.passthru or {})// {
-      kodiAddonFor = kodi;
-      requiredKodiAddons = requiredKodiAddons drv.propagatedBuildInputs;
-    };
-  });
-
-  # Check whether a derivation provides a Kodi addon.
-  hasKodiAddon = drv: drv ? kodiAddonFor && drv.kodiAddonFor == kodi;
-
-  # Get list of required Kodi addons given a list of derivations.
-  requiredKodiAddons = drvs: let
-      modules = filter hasKodiAddon drvs;
-    in unique (modules ++ concatLists (catAttrs "requiredKodiAddons" modules));
-
-  kodi-platform = stdenv.mkDerivation rec {
-    project = "kodi-platform";
-    version = "17.1";
-    name = "${project}-${version}";
-
-    src = fetchFromGitHub {
-      owner = "xbmc";
-      repo = project;
-      rev = "c8188d82678fec6b784597db69a68e74ff4986b5";
-      sha256 = "1r3gs3c6zczmm66qcxh9mr306clwb3p7ykzb70r3jv5jqggiz199";
-    };
-
-    nativeBuildInputs = [ cmake ];
-    buildInputs = [ kodi libcec_platform tinyxml ];
-  };
-
-  buildKodiAddon =
-    { name ? "${attrs.pname}-${attrs.version}"
-    , namespace
-    , sourceDir ? ""
-    , ... } @ attrs:
-  toKodiAddon (stdenv.mkDerivation ({
-    name = "kodi-" + name;
-
-    dontStrip = true;
-
-    extraRuntimeDependencies = [ ];
-
-    installPhase = ''
-      cd $src/$sourceDir
-      d=$out${addonDir}/${namespace}
-      mkdir -p $d
-      sauce="."
-      [ -d ${namespace} ] && sauce=${namespace}
-      cp -R "$sauce/"* $d
-    '';
-  } // attrs));
-
-  buildKodiBinaryAddon =
-    { name ? "${attrs.pname}-${attrs.version}"
-    , namespace
-    , version
-    , extraBuildInputs ? []
-    , extraRuntimeDependencies ? []
-    , extraInstallPhase ? "", ... } @ attrs:
-  toKodiAddon (stdenv.mkDerivation ({
-    name = "kodi-" + name;
-
-    dontStrip = true;
-
-    nativeBuildInputs = [ cmake ];
-    buildInputs = [ kodi kodi-platform libcec_platform ] ++ extraBuildInputs;
-
-    inherit extraRuntimeDependencies;
-
-    # disables check ensuring install prefix is that of kodi
-    cmakeFlags = [
-      "-DOVERRIDE_PATHS=1"
-    ];
-
-    # kodi checks for addon .so libs existance in the addon folder (share/...)
-    # and the non-wrapped kodi lib/... folder before even trying to dlopen
-    # them. Symlinking .so, as setting LD_LIBRARY_PATH is of no use
-    installPhase = let n = namespace; in ''
-      make install
-      ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version}
-      ${extraInstallPhase}
-    '';
-  } // attrs));
-
-  advanced-launcher = buildKodiAddon rec {
-
-    pname = "advanced-launcher";
-    namespace = "plugin.program.advanced.launcher";
-    version = "2.5.8";
-
-    src = fetchFromGitHub {
-      owner = "edwtjo";
-      repo = pname;
-      rev = version;
-      sha256 = "142vvgs37asq5m54xqhjzqvgmb0xlirvm0kz6lxaqynp0vvgrkx2";
-    };
-
-    meta = {
-      homepage = "https://forum.kodi.tv/showthread.php?tid=85724";
-      description = "A program launcher for Kodi";
-      longDescription = ''
-        Advanced Launcher allows you to start any Linux, Windows and
-        macOS external applications (with command line support or not)
-        directly from the Kodi GUI. Advanced Launcher also give you
-        the possibility to edit, download (from Internet resources)
-        and manage all the meta-data (informations and images) related
-        to these applications.
-      '';
-      platforms = platforms.all;
-      maintainers = with maintainers; [ edwtjo ];
-      broken = true; # requires port to python3
-    };
-
-  };
-
-  advanced-emulator-launcher = buildKodiAddon rec {
-
-    pname = "advanced-emulator-launcher";
-    namespace = "plugin.program.advanced.emulator.launcher";
-    version = "0.9.6";
-
-    src = fetchFromGitHub {
-      owner = "Wintermute0110";
-      repo = namespace;
-      rev = version;
-      sha256 = "1sv9z77jj6bam6llcnd9b3dgkbvhwad2m1v541rv3acrackms2z2";
-    };
-
-    meta = {
-      homepage = "https://forum.kodi.tv/showthread.php?tid=287826";
-      description = "A program launcher for Kodi";
-      longDescription = ''
-        Advanced Emulator Launcher is a multi-emulator front-end for Kodi
-        scalable to collections of thousands of ROMs. Includes offline scrapers
-        for MAME and No-Intro ROM sets and also supports scrapping ROM metadata
-        and artwork online. ROM auditing for No-Intro ROMs using No-Intro XML
-        DATs. Launching of games and standalone applications is also available.
-      '';
-      platforms = platforms.all;
-      maintainers = with maintainers; [ edwtjo ];
-      broken = true; # requires port to python3
-    };
-
-  };
-
-  controllers = let
-    pname = "game-controller";
-    version = "1.0.3";
-
-    src = fetchFromGitHub {
-      owner = "kodi-game";
-      repo = "kodi-game-controllers";
-      rev = "01acb5b6e8b85392b3cb298b034aadb1b24ccf18";
-      sha256 = "0sbc0w0fwbp7rbmbgb6a1kglhnn5g85hijcbbvf5x6jdq9v3f1qb";
-    };
-
-    meta = {
-      description = "Add support for different gaming controllers.";
-      platforms = platforms.all;
-      maintainers = with maintainers; [ edwtjo ];
-    };
-
-    mkController = controller: {
-        ${controller} = buildKodiAddon rec {
-          pname = pname + "-" + controller;
-          namespace = "game.controller." + controller;
-          sourceDir = "addons/" + namespace;
-          inherit version src meta;
-        };
-      };
-    in (mkController "default")
-    // (mkController "dreamcast")
-    // (mkController "gba")
-    // (mkController "genesis")
-    // (mkController "mouse")
-    // (mkController "n64")
-    // (mkController "nes")
-    // (mkController "ps")
-    // (mkController "snes");
-
-  hyper-launcher = let
-    pname = "hyper-launcher";
-    version = "1.5.2";
-    src = fetchFromGitHub rec {
-      name = pname + "-" + version + ".tar.gz";
-      owner = "teeedubb";
-      repo = owner + "-xbmc-repo";
-      rev = "f958ba93fe85b9c9025b1745d89c2db2e7dd9bf6";
-      sha256 = "1dvff24fbas25k5kvca4ssks9l1g5rfa3hl8lqxczkaqi3pp41j5";
-    };
-    meta = {
-      homepage = "https://forum.kodi.tv/showthread.php?tid=258159";
-      description = "A ROM launcher for Kodi that uses HyperSpin assets.";
-      maintainers = with maintainers; [ edwtjo ];
-      broken = true; # requires port to python3
-    };
-  in {
-    service = buildKodiAddon {
-      pname = pname + "-service";
-      version = "1.2.1";
-      namespace = "service.hyper.launcher";
-      inherit src meta;
-    };
-    plugin = buildKodiAddon {
-      namespace = "plugin.hyper.launcher";
-      inherit pname version src meta;
-    };
-  };
-
-  joystick = buildKodiBinaryAddon rec {
-    pname = namespace;
-    namespace = "peripheral.joystick";
-    version = "1.7.1";
-
-    src = fetchFromGitHub {
-      owner = "xbmc";
-      repo = namespace;
-      rev = "${version}-${rel}";
-      sha256 = "1dhj4afr9kj938xx70fq5r409mz6lbw4n581ljvdjj9lq7akc914";
-    };
-
-    meta = {
-      description = "Binary addon for raw joystick input.";
-      platforms = platforms.all;
-      maintainers = with maintainers; [ edwtjo ];
-    };
-
-    extraBuildInputs = [ tinyxml udev ];
-  };
-
-  simpleplugin = buildKodiAddon rec {
-    pname = "simpleplugin";
-    namespace = "script.module.simpleplugin";
-    version = "2.3.2";
-
-    src = fetchFromGitHub {
-      owner = "romanvm";
-      repo = namespace;
-      rev = "v.${version}";
-      sha256 = "0myar8dqjigb75pcc8zx3i5z79p1ifgphgb82s5syqywk0zaxm3j";
-    };
-
-    meta = {
-      homepage = src.meta.homepage;
-      description = "Simpleplugin API";
-      license = licenses.gpl3;
-      broken = true; # requires port to python3
-    };
-  };
-
-  svtplay = buildKodiAddon rec {
-
-    pname = "svtplay";
-    namespace = "plugin.video.svtplay";
-    version = "5.1.12";
-
-    src = fetchFromGitHub {
-      name = pname + "-" + version + ".tar.gz";
-      owner = "nilzen";
-      repo = "xbmc-" + pname;
-      rev = "v${version}";
-      sha256 = "04j1nhm7mh9chs995lz6bv1vsq5xzk7a7c0lmk4bnfv8jrfpj0w6";
-    };
-
-    meta = {
-      homepage = "https://forum.kodi.tv/showthread.php?tid=67110";
-      description = "Watch content from SVT Play";
-      longDescription = ''
-        With this addon you can stream content from SVT Play
-        (svtplay.se). The plugin fetches the video URL from the SVT
-        Play website and feeds it to the Kodi video player. HLS (m3u8)
-        is the preferred video format by the plugin.
-      '';
-      platforms = platforms.all;
-      maintainers = with maintainers; [ edwtjo ];
-    };
-
-  };
-
-  steam-controller = buildKodiBinaryAddon rec {
-    pname = namespace;
-    namespace = "peripheral.steamcontroller";
-    version = "0.11.0";
-
-    src = fetchFromGitHub {
-      owner = "kodi-game";
-      repo = namespace;
-      rev = "f68140ca44f163a03d3a625d1f2005a6edef96cb";
-      sha256 = "09lm8i119xlsxxk0c64rnp8iw0crr90v7m8iwi9r31qdmxrdxpmg";
-    };
-
-    extraBuildInputs = [ libusb1 ];
-
-    meta = {
-      description = "Binary addon for steam controller.";
-      platforms = platforms.all;
-      maintainers = with maintainers; [ edwtjo ];
-    };
-
-  };
-
-  steam-launcher = buildKodiAddon {
-
-    pname = "steam-launcher";
-    namespace = "script.steam.launcher";
-    version = "3.5.1";
-
-    src = fetchFromGitHub rec {
-      owner = "teeedubb";
-      repo = owner + "-xbmc-repo";
-      rev = "8260bf9b464846a1f1965da495d2f2b7ceb81d55";
-      sha256 = "1fj3ry5s44nf1jzxk4bmnpa4b9p23nrpmpj2a4i6xf94h7jl7p5k";
-    };
-
-    propagatedBuildInputs = [ steam ];
-
-    meta = {
-      homepage = "https://forum.kodi.tv/showthread.php?tid=157499";
-      description = "Launch Steam in Big Picture Mode from Kodi";
-      longDescription = ''
-        This add-on will close/minimise Kodi, launch Steam in Big
-        Picture Mode and when Steam BPM is exited (either by quitting
-        Steam or returning to the desktop) Kodi will
-        restart/maximise. Running pre/post Steam scripts can be
-        configured via the addon.
-      '';
-      maintainers = with maintainers; [ edwtjo ];
-    };
-  };
-
-  pdfreader = buildKodiAddon rec {
-    pname = "pdfreader";
-    namespace = "plugin.image.pdf";
-    version = "2.0.2";
-
-    src = fetchFromGitHub {
-      owner = "i96751414";
-      repo = "plugin.image.pdfreader";
-      rev = "v${version}";
-      sha256 = "0nkqhlm1gyagq6xpdgqvd5qxyr2ngpml9smdmzfabc8b972mwjml";
-    };
-
-    meta = {
-      homepage = "https://forum.kodi.tv/showthread.php?tid=187421";
-      description = "A comic book reader";
-      maintainers = with maintainers; [ edwtjo ];
-    };
-  };
-
-  pvr-hts = buildKodiBinaryAddon rec {
-
-    pname = "pvr-hts";
-    namespace = "pvr.hts";
-    version = "8.2.2";
-
-    src = fetchFromGitHub {
-      owner = "kodi-pvr";
-      repo = "pvr.hts";
-      rev = "${version}-${rel}";
-      sha256 = "0jnn9gfjl556acqjf92wzzn371gxymhbbi665nqgg2gjcan0a49q";
-    };
-
-    meta = {
-      homepage = "https://github.com/kodi-pvr/pvr.hts";
-      description = "Kodi's Tvheadend HTSP client addon";
-      platforms = platforms.all;
-      maintainers = with maintainers; [ cpages ];
-    };
-
-  };
-
-  pvr-hdhomerun = buildKodiBinaryAddon rec {
-
-    pname = "pvr-hdhomerun";
-    namespace = "pvr.hdhomerun";
-    version = "7.1.0";
-
-    src = fetchFromGitHub {
-      owner = "kodi-pvr";
-      repo = "pvr.hdhomerun";
-      rev = "${version}-${rel}";
-      sha256 = "0gbwjssnd319csq2kwlyjj1rskg19m1dxac5dl2dymvx5hn3zrgm";
-    };
-
-    meta = {
-      homepage = "https://github.com/kodi-pvr/pvr.hdhomerun";
-      description = "Kodi's HDHomeRun PVR client addon";
-      platforms = platforms.all;
-      maintainers = with maintainers; [ titanous ];
-    };
-
-    extraBuildInputs = [ jsoncpp libhdhomerun ];
-
-  };
-
-  pvr-iptvsimple = buildKodiBinaryAddon rec {
-
-    pname = "pvr-iptvsimple";
-    namespace = "pvr.iptvsimple";
-    version = "7.4.2";
-
-    src = fetchFromGitHub {
-      owner = "kodi-pvr";
-      repo = "pvr.iptvsimple";
-      rev = "${version}-${rel}";
-      sha256 = "062i922qi0izkvn7v47yhyy2cf3fa7xc3k95b1gm9abfdwkk8ywr";
-    };
-
-    meta = {
-      homepage = "https://github.com/kodi-pvr/pvr.iptvsimple";
-      description = "Kodi's IPTV Simple client addon";
-      platforms = platforms.all;
-      maintainers = with maintainers; [ ];
-      license = licenses.gpl2Plus;
-    };
-
-    extraBuildInputs = [ zlib pugixml ];
-  };
-
-  osmc-skin = buildKodiAddon rec {
-
-    pname = "osmc-skin";
-    namespace = "skin.osmc";
-    version = "18.0.0";
-
-    src = fetchFromGitHub {
-      owner = "osmc";
-      repo = namespace;
-      rev = "40a6c318641e2cbeac58fb0e7dde9c2beac737a0";
-      sha256 = "1l7hyfj5zvjxjdm94y325bmy1naak455b9l8952sb0gllzrcwj6s";
-    };
-
-    meta = {
-      homepage = "https://github.com/osmc/skin.osmc";
-      description = "The default skin for OSMC";
-      platforms = platforms.all;
-      maintainers = with maintainers; [ worldofpeace ];
-      license = licenses.cc-by-nc-sa-30;
-    };
-  };
-
-  yatp = python3Packages.toPythonModule (buildKodiAddon rec {
-    pname = "yatp";
-    namespace = "plugin.video.yatp";
-    version = "3.3.2";
-
-    src = fetchFromGitHub {
-      owner = "romanvm";
-      repo = "kodi.yatp";
-      rev = "v.${version}";
-      sha256 = "12g1f57sx7dy6wy7ljl7siz2qs1kxcmijcg7xx2xpvmq61x9qa2d";
-    };
-
-    patches = [ ./yatp/dont-monkey.patch ];
-
-    propagatedBuildInputs = [
-      simpleplugin
-      python3Packages.requests
-      python3Packages.libtorrent-rasterbar
-    ];
-
-    meta = {
-      homepage = src.meta.homepage;
-      description = "Yet Another Torrent Player: libtorrent-based torrent streaming for Kodi";
-      license = licenses.gpl3;
-      broken = true; # requires port to python3
-    };
-  });
-
-  inputstream-adaptive = buildKodiBinaryAddon rec {
-
-    pname = "inputstream-adaptive";
-    namespace = "inputstream.adaptive";
-    version = "2.6.7";
-
-    src = fetchFromGitHub {
-      owner = "peak3d";
-      repo = "inputstream.adaptive";
-      rev = "${version}-${rel}";
-      sha256 = "1pwqmbr78wp12jn6rwv63npdfc456adwz0amlxf6gvgg43li6p7s";
-    };
-
-    extraBuildInputs = [ expat ];
-
-    extraRuntimeDependencies = [ glib nspr nss stdenv.cc.cc.lib ];
-
-    extraInstallPhase = let n = namespace; in ''
-      ln -s $out/lib/addons/${n}/libssd_wv.so $out/${addonDir}/${n}/libssd_wv.so
-    '';
-
-    meta = {
-      homepage = "https://github.com/peak3d/inputstream.adaptive";
-      description = "Kodi inputstream addon for several manifest types";
-      platforms = platforms.all;
-      maintainers = with maintainers; [ sephalon ];
-    };
-  };
-
-  vfs-sftp = buildKodiBinaryAddon rec {
-    pname = namespace;
-    namespace = "vfs.sftp";
-    version = "2.0.0";
-
-    src = fetchFromGitHub {
-      owner = "xbmc";
-      repo = namespace;
-      rev = "${version}-${rel}";
-      sha256 = "06w74sh8yagrrp7a7rjaz3xrh1j3wdqald9c4b72c33gpk5997dk";
-    };
-
-    meta = with lib; {
-      description = "SFTP Virtual Filesystem add-on for Kodi";
-      license = licenses.gpl2Plus;
-      platforms = platforms.all;
-      maintainers = with maintainers; [ minijackson ];
-    };
-
-    extraBuildInputs = [ openssl libssh zlib ];
-  };
-
-  vfs-libarchive = buildKodiBinaryAddon rec {
-    pname = namespace;
-    namespace = "vfs.libarchive";
-    version = "2.0.0";
-
-    src = fetchFromGitHub {
-      owner = "xbmc";
-      repo = namespace;
-      rev = "${version}-${rel}";
-      sha256 = "1q62p1i6rvqk2zv6f1cpffkh95lgclys2xl4dwyhj3acmqdxd9i5";
-    };
-
-    meta = with lib; {
-      description = "LibArchive Virtual Filesystem add-on for Kodi";
-      license = licenses.gpl2Plus;
-      platforms = platforms.all;
-      maintainers = with maintainers; [ minijackson ];
-    };
-
-    extraBuildInputs = [ libarchive lzma bzip2 zlib lz4 lzo openssl ];
-  };
-}; in self
diff --git a/pkgs/applications/video/kodi/wrapper.nix b/pkgs/applications/video/kodi/wrapper.nix
index 2b4abbb500aff..86164682138d8 100644
--- a/pkgs/applications/video/kodi/wrapper.nix
+++ b/pkgs/applications/video/kodi/wrapper.nix
@@ -1,5 +1,10 @@
 { lib, makeWrapper, buildEnv, kodi, addons }:
 
+let
+  # linux distros are supposed to provide pillow and pycryptodome
+  requiredPythonPackages = with kodi.pythonPackages; [ pillow pycryptodome] ++ addons;
+in
+
 buildEnv {
   name = "${kodi.name}-env";
 
@@ -13,7 +18,7 @@ buildEnv {
     for exe in kodi{,-standalone}
     do
       makeWrapper ${kodi}/bin/$exe $out/bin/$exe \
-        --prefix PYTHONPATH : ${kodi.pythonPackages.makePythonPath addons} \
+        --prefix PYTHONPATH : ${kodi.pythonPackages.makePythonPath requiredPythonPackages} \
         --prefix KODI_HOME : $out/share/kodi \
         --prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
           (lib.concatMap
diff --git a/pkgs/applications/video/kodi/yatp/dont-monkey.patch b/pkgs/applications/video/kodi/yatp/dont-monkey.patch
deleted file mode 100644
index 62d5d0c0d4c06..0000000000000
--- a/pkgs/applications/video/kodi/yatp/dont-monkey.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/plugin.video.yatp/server.py b/plugin.video.yatp/server.py
-index 1adcbb5..488b72c 100644
---- a/plugin.video.yatp/server.py
-+++ b/plugin.video.yatp/server.py
-@@ -20,24 +20,8 @@ addon = Addon()
- _ = addon.initialize_gettext()
- addon.log_notice('Starting Torrent Server...')
- 
--# A monkey-patch to set the necessary librorrent version
--librorrent_addon = Addon('script.module.libtorrent')
--orig_custom_version = librorrent_addon.get_setting('custom_version', False)
--orig_set_version = librorrent_addon.get_setting('set_version', False)
--librorrent_addon.set_setting('custom_version', 'true')
--if addon.libtorrent_version == '1.0.9':
--    librorrent_addon.set_setting('set_version', '4')
--elif addon.libtorrent_version == '1.1.0':
--    librorrent_addon.set_setting('set_version', '5')
--elif addon.libtorrent_version == '1.1.1':
--    librorrent_addon.set_setting('set_version', '6')
--else:
--    librorrent_addon.set_setting('set_version', '0')
--
- from libs.server import wsgi_app
- 
--librorrent_addon.set_setting('custom_version', orig_custom_version)
--librorrent_addon.set_setting('set_version', orig_set_version)
- # ======
- 
- if addon.enable_limits: