From 6fe6c35a9660a18cdf93b99f141a5b9a0eb06be5 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Sat, 20 Mar 2021 10:40:52 -0400 Subject: [PATCH 1/3] kodi.packages.buildKodiAddon, kodi.packages.buildKodiBinaryAddon: include runHook preInstall and postInstall --- pkgs/applications/video/kodi/build-kodi-addon.nix | 4 ++++ pkgs/applications/video/kodi/build-kodi-binary-addon.nix | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkgs/applications/video/kodi/build-kodi-addon.nix b/pkgs/applications/video/kodi/build-kodi-addon.nix index cd768b6fa99..572d5dda805 100644 --- a/pkgs/applications/video/kodi/build-kodi-addon.nix +++ b/pkgs/applications/video/kodi/build-kodi-addon.nix @@ -11,11 +11,15 @@ toKodiAddon (stdenv.mkDerivation ({ extraRuntimeDependencies = [ ]; installPhase = '' + runHook preInstall + cd $src/$sourceDir d=$out${addonDir}/${namespace} mkdir -p $d sauce="." [ -d ${namespace} ] && sauce=${namespace} cp -R "$sauce/"* $d + + runHook postInstall ''; } // attrs)) diff --git a/pkgs/applications/video/kodi/build-kodi-binary-addon.nix b/pkgs/applications/video/kodi/build-kodi-binary-addon.nix index 74ce508ab6a..e0ca5d1cf6e 100644 --- a/pkgs/applications/video/kodi/build-kodi-binary-addon.nix +++ b/pkgs/applications/video/kodi/build-kodi-binary-addon.nix @@ -24,8 +24,12 @@ toKodiAddon (stdenv.mkDerivation ({ # 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 '' + runHook preInstall + make install ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version} ${extraInstallPhase} + + runHook postInstall ''; } // attrs)) From d9b776a3a26a8a55dd1b531e331670dc6be15bc9 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Sat, 20 Mar 2021 10:44:08 -0400 Subject: [PATCH 2/3] kodi.packages.jellyfin: init at 0.7.1 --- .../video/kodi-packages/dateutil/default.nix | 27 ++++++++++ .../video/kodi-packages/jellyfin/default.nix | 49 +++++++++++++++++++ .../video/kodi-packages/kodi-six/default.nix | 23 +++++++++ .../video/kodi-packages/six/default.nix | 23 +++++++++ pkgs/top-level/kodi-packages.nix | 8 +++ 5 files changed, 130 insertions(+) create mode 100644 pkgs/applications/video/kodi-packages/dateutil/default.nix create mode 100644 pkgs/applications/video/kodi-packages/jellyfin/default.nix create mode 100644 pkgs/applications/video/kodi-packages/kodi-six/default.nix create mode 100644 pkgs/applications/video/kodi-packages/six/default.nix diff --git a/pkgs/applications/video/kodi-packages/dateutil/default.nix b/pkgs/applications/video/kodi-packages/dateutil/default.nix new file mode 100644 index 00000000000..665858d3d57 --- /dev/null +++ b/pkgs/applications/video/kodi-packages/dateutil/default.nix @@ -0,0 +1,27 @@ +{ lib, buildKodiAddon, fetchzip, addonUpdateScript, six }: + +buildKodiAddon rec { + pname = "dateutil"; + namespace = "script.module.dateutil"; + version = "2.8.1+matrix.1"; + + src = fetchzip { + url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip"; + sha256 = "1jr77017ihs7j3455i72af71wyvs792kbizq4539ccd98far8lm7"; + }; + + propagatedBuildInputs = [ + six + ]; + + passthru.updateScript = addonUpdateScript { + attrPath = "kodi.packages.dateutil"; + }; + + meta = with lib; { + homepage = "https://dateutil.readthedocs.io/en/stable/"; + description = "Extensions to the standard Python datetime module"; + license = with licenses; [ asl20 bsd3 ]; + maintainers = teams.kodi.members; + }; +} diff --git a/pkgs/applications/video/kodi-packages/jellyfin/default.nix b/pkgs/applications/video/kodi-packages/jellyfin/default.nix new file mode 100644 index 00000000000..03a037ce538 --- /dev/null +++ b/pkgs/applications/video/kodi-packages/jellyfin/default.nix @@ -0,0 +1,49 @@ +{ lib, addonDir, buildKodiAddon, fetchFromGitHub, kodi, requests, dateutil, six, kodi-six, signals }: +let + python = kodi.pythonPackages.python.withPackages (p: with p; [ pyyaml ]); +in +buildKodiAddon rec { + pname = "jellyfin"; + namespace = "plugin.video.jellyfin"; + version = "0.7.1"; + + src = fetchFromGitHub { + owner = "jellyfin"; + repo = "jellyfin-kodi"; + rev = "v${version}"; + sha256 = "0fx20gmd5xlg59ks4433qh2b3jhbs5qrnc49zi4rkqqr4jr4nhnn"; + }; + + nativeBuildInputs = [ + python + ]; + + prePatch = '' + substituteInPlace .config/generate_xml.py \ + --replace "'jellyfin-kodi/release.yaml'" "'release.yaml'" \ + --replace "'jellyfin-kodi/addon.xml'" "'addon.xml'" + ''; + + buildPhase = '' + ${python}/bin/python3 .config/generate_xml.py py3 + ''; + + postInstall = '' + mv /build/source/addon.xml $out${addonDir}/${namespace}/ + ''; + + propagatedBuildInputs = [ + requests + dateutil + six + kodi-six + signals + ]; + + meta = with lib; { + homepage = "https://jellyfin.org/"; + description = "A whole new way to manage and view your media library"; + license = licenses.gpl3Only; + maintainers = teams.kodi.members; + }; +} diff --git a/pkgs/applications/video/kodi-packages/kodi-six/default.nix b/pkgs/applications/video/kodi-packages/kodi-six/default.nix new file mode 100644 index 00000000000..b4f1169b36d --- /dev/null +++ b/pkgs/applications/video/kodi-packages/kodi-six/default.nix @@ -0,0 +1,23 @@ +{ lib, buildKodiAddon, fetchzip, addonUpdateScript }: + +buildKodiAddon rec { + pname = "kodi-six"; + namespace = "script.module.kodi-six"; + version = "0.1.3.1"; + + src = fetchzip { + url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip"; + sha256 = "14m232p9hx925pbk8knsg994m1nbpa5278zmcrnfblh4z84gjv4x"; + }; + + passthru.updateScript = addonUpdateScript { + attrPath = "kodi.packages.kodi-six"; + }; + + meta = with lib; { + homepage = "https://github.com/romanvm/kodi.six"; + description = "Wrappers around Kodi Python API for seamless Python 2/3 compatibility"; + license = licenses.gpl3Only; + maintainers = teams.kodi.members; + }; +} diff --git a/pkgs/applications/video/kodi-packages/six/default.nix b/pkgs/applications/video/kodi-packages/six/default.nix new file mode 100644 index 00000000000..8d7b8f936f3 --- /dev/null +++ b/pkgs/applications/video/kodi-packages/six/default.nix @@ -0,0 +1,23 @@ +{ lib, buildKodiAddon, fetchzip, addonUpdateScript }: + +buildKodiAddon rec { + pname = "six"; + namespace = "script.module.six"; + version = "1.14.0+matrix.2"; + + src = fetchzip { + url = "https://mirrors.kodi.tv/addons/matrix/${namespace}/${namespace}-${version}.zip"; + sha256 = "1f9g43j4y5x7b1bgbwqqfj0p2bkqjpycj17dj7a9j271mcr5zhwb"; + }; + + passthru.updateScript = addonUpdateScript { + attrPath = "kodi.packages.six"; + }; + + meta = with lib; { + homepage = "https://pypi.org/project/six/"; + description = "Python 2 and 3 compatibility utilities"; + license = licenses.mit; + maintainers = teams.kodi.members; + }; +} diff --git a/pkgs/top-level/kodi-packages.nix b/pkgs/top-level/kodi-packages.nix index f9b20dd2bc7..03d70a32f6a 100644 --- a/pkgs/top-level/kodi-packages.nix +++ b/pkgs/top-level/kodi-packages.nix @@ -66,6 +66,8 @@ let self = rec { snes = callPackage ../applications/video/kodi-packages/controllers { controller = "snes"; }; }; + jellyfin = callPackage ../applications/video/kodi-packages/jellyfin { }; + joystick = callPackage ../applications/video/kodi-packages/joystick { }; netflix = callPackage ../applications/video/kodi-packages/netflix { }; @@ -96,18 +98,24 @@ let self = rec { chardet = callPackage ../applications/video/kodi-packages/chardet { }; + dateutil = callPackage ../applications/video/kodi-packages/dateutil { }; + idna = callPackage ../applications/video/kodi-packages/idna { }; inputstream-adaptive = callPackage ../applications/video/kodi-packages/inputstream-adaptive { }; inputstreamhelper = callPackage ../applications/video/kodi-packages/inputstreamhelper { }; + kodi-six = callPackage ../applications/video/kodi-packages/kodi-six { }; + myconnpy = callPackage ../applications/video/kodi-packages/myconnpy { }; requests = callPackage ../applications/video/kodi-packages/requests { }; signals = callPackage ../applications/video/kodi-packages/signals { }; + six = callPackage ../applications/video/kodi-packages/six { }; + urllib3 = callPackage ../applications/video/kodi-packages/urllib3 { }; }; in self From e3e54e6001d8c032daf8dc9b970fa509df0550a8 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Sat, 20 Mar 2021 10:44:57 -0400 Subject: [PATCH 3/3] kodi.packages.netflix: add inputstream-adaptive dependency --- pkgs/applications/video/kodi-packages/netflix/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/video/kodi-packages/netflix/default.nix b/pkgs/applications/video/kodi-packages/netflix/default.nix index 80308bb1eb1..e187fad9737 100644 --- a/pkgs/applications/video/kodi-packages/netflix/default.nix +++ b/pkgs/applications/video/kodi-packages/netflix/default.nix @@ -1,4 +1,5 @@ -{ lib, buildKodiAddon, fetchFromGitHub, signals, inputstreamhelper, requests, myconnpy }: +{ lib, buildKodiAddon, fetchFromGitHub, signals, inputstream-adaptive, inputstreamhelper, requests, myconnpy }: + buildKodiAddon rec { pname = "netflix"; namespace = "plugin.video.netflix"; @@ -13,6 +14,7 @@ buildKodiAddon rec { propagatedBuildInputs = [ signals + inputstream-adaptive inputstreamhelper requests myconnpy