kodiPlugins: rename to kodiPackages

This commit is contained in:
Aaron Andersen 2021-03-09 20:53:45 -05:00
parent 0fad702a50
commit 917f7efdc5
4 changed files with 85 additions and 76 deletions

View file

@ -8,31 +8,31 @@ with lib;
let self = rec { let self = rec {
pluginDir = "/share/kodi/addons"; addonDir = "/share/kodi/addons";
rel = "Matrix"; rel = "Matrix";
kodi = kodiPlain; kodi = kodiPlain;
# Convert derivation to a kodi module. Stolen from ../../../top-level/python-packages.nix # Convert derivation to a kodi module. Stolen from ../../../top-level/python-packages.nix
toKodiPlugin = drv: drv.overrideAttrs(oldAttrs: { toKodiAddon = drv: drv.overrideAttrs(oldAttrs: {
# Use passthru in order to prevent rebuilds when possible. # Use passthru in order to prevent rebuilds when possible.
passthru = (oldAttrs.passthru or {})// { passthru = (oldAttrs.passthru or {})// {
kodiPluginFor = kodi; kodiAddonFor = kodi;
requiredKodiPlugins = requiredKodiPlugins drv.propagatedBuildInputs; requiredKodiAddons = requiredKodiAddons drv.propagatedBuildInputs;
}; };
}); });
# Check whether a derivation provides a Kodi plugin. # Check whether a derivation provides a Kodi addon.
hasKodiPlugin = drv: drv ? kodiPluginFor && drv.kodiPluginFor == kodi; hasKodiAddon = drv: drv ? kodiAddonFor && drv.kodiAddonFor == kodi;
# Get list of required Kodi plugins given a list of derivations. # Get list of required Kodi addons given a list of derivations.
requiredKodiPlugins = drvs: let requiredKodiAddons = drvs: let
modules = filter hasKodiPlugin drvs; modules = filter hasKodiAddon drvs;
in unique (modules ++ concatLists (catAttrs "requiredKodiPlugins" modules)); in unique (modules ++ concatLists (catAttrs "requiredKodiAddons" modules));
kodiWithPlugins = func: callPackage ./wrapper.nix { kodiWithAddons = func: callPackage ./wrapper.nix {
inherit kodi; inherit kodi;
plugins = requiredKodiPlugins (func self); addons = requiredKodiAddons (func self);
}; };
kodi-platform = stdenv.mkDerivation rec { kodi-platform = stdenv.mkDerivation rec {
@ -51,9 +51,13 @@ let self = rec {
buildInputs = [ kodiPlain libcec_platform tinyxml ]; buildInputs = [ kodiPlain libcec_platform tinyxml ];
}; };
mkKodiPlugin = { plugin, namespace, version, sourceDir ? null, ... }@args: buildKodiAddon =
toKodiPlugin (stdenv.mkDerivation ({ { name ? "${attrs.pname}-${attrs.version}"
name = "kodi-plugin-${plugin}-${version}"; , namespace
, sourceDir ? null
, ... } @ attrs:
toKodiAddon (stdenv.mkDerivation ({
name = "kodi-" + name;
dontStrip = true; dontStrip = true;
@ -61,18 +65,23 @@ let self = rec {
installPhase = '' installPhase = ''
${if sourceDir == null then "" else "cd $src/$sourceDir"} ${if sourceDir == null then "" else "cd $src/$sourceDir"}
d=$out${pluginDir}/${namespace} d=$out${addonDir}/${namespace}
mkdir -p $d mkdir -p $d
sauce="." sauce="."
[ -d ${namespace} ] && sauce=${namespace} [ -d ${namespace} ] && sauce=${namespace}
cp -R "$sauce/"* $d cp -R "$sauce/"* $d
''; '';
} // args)); } // attrs));
mkKodiABIPlugin = { plugin, namespace, version, extraBuildInputs ? [], buildKodiBinaryAddon =
extraRuntimeDependencies ? [], extraInstallPhase ? "", ... }@args: { name ? "${attrs.pname}-${attrs.version}"
toKodiPlugin (stdenv.mkDerivation ({ , namespace
name = "kodi-plugin-${plugin}-${version}"; , version
, extraBuildInputs ? []
, extraRuntimeDependencies ? []
, extraInstallPhase ? "", ... } @ attrs:
toKodiAddon (stdenv.mkDerivation ({
name = "kodi-" + name;
dontStrip = true; dontStrip = true;
@ -86,25 +95,25 @@ let self = rec {
"-DOVERRIDE_PATHS=1" "-DOVERRIDE_PATHS=1"
]; ];
# kodi checks for plugin .so libs existance in the addon folder (share/...) # kodi checks for addon .so libs existance in the addon folder (share/...)
# and the non-wrapped kodi lib/... folder before even trying to dlopen # and the non-wrapped kodi lib/... folder before even trying to dlopen
# them. Symlinking .so, as setting LD_LIBRARY_PATH is of no use # them. Symlinking .so, as setting LD_LIBRARY_PATH is of no use
installPhase = let n = namespace; in '' installPhase = let n = namespace; in ''
make install make install
ln -s $out/lib/addons/${n}/${n}.so.${version} $out${pluginDir}/${n}/${n}.so.${version} ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version}
${extraInstallPhase} ${extraInstallPhase}
''; '';
} // args)); } // attrs));
advanced-launcher = mkKodiPlugin rec { advanced-launcher = buildKodiAddon rec {
plugin = "advanced-launcher"; pname = "advanced-launcher";
namespace = "plugin.program.advanced.launcher"; namespace = "plugin.program.advanced.launcher";
version = "2.5.8"; version = "2.5.8";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "edwtjo"; owner = "edwtjo";
repo = plugin; repo = pname;
rev = version; rev = version;
sha256 = "142vvgs37asq5m54xqhjzqvgmb0xlirvm0kz6lxaqynp0vvgrkx2"; sha256 = "142vvgs37asq5m54xqhjzqvgmb0xlirvm0kz6lxaqynp0vvgrkx2";
}; };
@ -127,9 +136,9 @@ let self = rec {
}; };
advanced-emulator-launcher = mkKodiPlugin rec { advanced-emulator-launcher = buildKodiAddon rec {
plugin = "advanced-emulator-launcher"; pname = "advanced-emulator-launcher";
namespace = "plugin.program.advanced.emulator.launcher"; namespace = "plugin.program.advanced.emulator.launcher";
version = "0.9.6"; version = "0.9.6";
@ -175,8 +184,8 @@ let self = rec {
}; };
mkController = controller: { mkController = controller: {
${controller} = mkKodiPlugin rec { ${controller} = buildKodiAddon rec {
plugin = pname + "-" + controller; pname = pname + "-" + controller;
namespace = "game.controller." + controller; namespace = "game.controller." + controller;
sourceDir = "addons/" + namespace; sourceDir = "addons/" + namespace;
inherit version src meta; inherit version src meta;
@ -209,23 +218,22 @@ let self = rec {
broken = true; # requires port to python3 broken = true; # requires port to python3
}; };
in { in {
service = mkKodiPlugin { service = buildKodiAddon {
plugin = pname + "-service"; pname = pname + "-service";
version = "1.2.1"; version = "1.2.1";
namespace = "service.hyper.launcher"; namespace = "service.hyper.launcher";
inherit src meta; inherit src meta;
}; };
plugin = mkKodiPlugin { plugin = buildKodiAddon {
plugin = pname;
namespace = "plugin.hyper.launcher"; namespace = "plugin.hyper.launcher";
inherit version src meta; inherit pname version src meta;
}; };
}; };
joystick = mkKodiABIPlugin rec { joystick = buildKodiBinaryAddon rec {
pname = namespace;
namespace = "peripheral.joystick"; namespace = "peripheral.joystick";
version = "1.7.1"; version = "1.7.1";
plugin = namespace;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "xbmc"; owner = "xbmc";
@ -243,8 +251,8 @@ let self = rec {
extraBuildInputs = [ tinyxml udev ]; extraBuildInputs = [ tinyxml udev ];
}; };
simpleplugin = mkKodiPlugin rec { simpleplugin = buildKodiAddon rec {
plugin = "simpleplugin"; pname = "simpleplugin";
namespace = "script.module.simpleplugin"; namespace = "script.module.simpleplugin";
version = "2.3.2"; version = "2.3.2";
@ -263,16 +271,16 @@ let self = rec {
}; };
}; };
svtplay = mkKodiPlugin rec { svtplay = buildKodiAddon rec {
plugin = "svtplay"; pname = "svtplay";
namespace = "plugin.video.svtplay"; namespace = "plugin.video.svtplay";
version = "5.1.12"; version = "5.1.12";
src = fetchFromGitHub { src = fetchFromGitHub {
name = plugin + "-" + version + ".tar.gz"; name = pname + "-" + version + ".tar.gz";
owner = "nilzen"; owner = "nilzen";
repo = "xbmc-" + plugin; repo = "xbmc-" + pname;
rev = "v${version}"; rev = "v${version}";
sha256 = "04j1nhm7mh9chs995lz6bv1vsq5xzk7a7c0lmk4bnfv8jrfpj0w6"; sha256 = "04j1nhm7mh9chs995lz6bv1vsq5xzk7a7c0lmk4bnfv8jrfpj0w6";
}; };
@ -292,10 +300,10 @@ let self = rec {
}; };
steam-controller = mkKodiABIPlugin rec { steam-controller = buildKodiBinaryAddon rec {
pname = namespace;
namespace = "peripheral.steamcontroller"; namespace = "peripheral.steamcontroller";
version = "0.11.0"; version = "0.11.0";
plugin = namespace;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "kodi-game"; owner = "kodi-game";
@ -314,9 +322,9 @@ let self = rec {
}; };
steam-launcher = mkKodiPlugin { steam-launcher = buildKodiAddon {
plugin = "steam-launcher"; pname = "steam-launcher";
namespace = "script.steam.launcher"; namespace = "script.steam.launcher";
version = "3.5.1"; version = "3.5.1";
@ -343,8 +351,8 @@ let self = rec {
}; };
}; };
pdfreader = mkKodiPlugin rec { pdfreader = buildKodiAddon rec {
plugin = "pdfreader"; pname = "pdfreader";
namespace = "plugin.image.pdf"; namespace = "plugin.image.pdf";
version = "2.0.2"; version = "2.0.2";
@ -362,9 +370,9 @@ let self = rec {
}; };
}; };
pvr-hts = mkKodiABIPlugin rec { pvr-hts = buildKodiBinaryAddon rec {
plugin = "pvr-hts"; pname = "pvr-hts";
namespace = "pvr.hts"; namespace = "pvr.hts";
version = "8.2.2"; version = "8.2.2";
@ -384,9 +392,9 @@ let self = rec {
}; };
pvr-hdhomerun = mkKodiABIPlugin rec { pvr-hdhomerun = buildKodiBinaryAddon rec {
plugin = "pvr-hdhomerun"; pname = "pvr-hdhomerun";
namespace = "pvr.hdhomerun"; namespace = "pvr.hdhomerun";
version = "7.1.0"; version = "7.1.0";
@ -408,9 +416,9 @@ let self = rec {
}; };
pvr-iptvsimple = mkKodiABIPlugin rec { pvr-iptvsimple = buildKodiBinaryAddon rec {
plugin = "pvr-iptvsimple"; pname = "pvr-iptvsimple";
namespace = "pvr.iptvsimple"; namespace = "pvr.iptvsimple";
version = "7.4.2"; version = "7.4.2";
@ -432,9 +440,9 @@ let self = rec {
extraBuildInputs = [ zlib pugixml ]; extraBuildInputs = [ zlib pugixml ];
}; };
osmc-skin = mkKodiPlugin rec { osmc-skin = buildKodiAddon rec {
plugin = "osmc-skin"; pname = "osmc-skin";
namespace = "skin.osmc"; namespace = "skin.osmc";
version = "18.0.0"; version = "18.0.0";
@ -454,8 +462,8 @@ let self = rec {
}; };
}; };
yatp = python3Packages.toPythonModule (mkKodiPlugin rec { yatp = python3Packages.toPythonModule (buildKodiAddon rec {
plugin = "yatp"; pname = "yatp";
namespace = "plugin.video.yatp"; namespace = "plugin.video.yatp";
version = "3.3.2"; version = "3.3.2";
@ -482,9 +490,9 @@ let self = rec {
}; };
}); });
inputstream-adaptive = mkKodiABIPlugin rec { inputstream-adaptive = buildKodiBinaryAddon rec {
plugin = "inputstream-adaptive"; pname = "inputstream-adaptive";
namespace = "inputstream.adaptive"; namespace = "inputstream.adaptive";
version = "2.6.7"; version = "2.6.7";
@ -500,7 +508,7 @@ let self = rec {
extraRuntimeDependencies = [ glib nspr nss stdenv.cc.cc.lib ]; extraRuntimeDependencies = [ glib nspr nss stdenv.cc.cc.lib ];
extraInstallPhase = let n = namespace; in '' extraInstallPhase = let n = namespace; in ''
ln -s $out/lib/addons/${n}/libssd_wv.so $out/${pluginDir}/${n}/libssd_wv.so ln -s $out/lib/addons/${n}/libssd_wv.so $out/${addonDir}/${n}/libssd_wv.so
''; '';
meta = { meta = {
@ -511,10 +519,10 @@ let self = rec {
}; };
}; };
vfs-sftp = mkKodiABIPlugin rec { vfs-sftp = buildKodiBinaryAddon rec {
pname = namespace;
namespace = "vfs.sftp"; namespace = "vfs.sftp";
version = "2.0.0"; version = "2.0.0";
plugin = namespace;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "xbmc"; owner = "xbmc";
@ -533,10 +541,10 @@ let self = rec {
extraBuildInputs = [ openssl libssh zlib ]; extraBuildInputs = [ openssl libssh zlib ];
}; };
vfs-libarchive = mkKodiABIPlugin rec { vfs-libarchive = buildKodiBinaryAddon rec {
pname = namespace;
namespace = "vfs.libarchive"; namespace = "vfs.libarchive";
version = "2.0.0"; version = "2.0.0";
plugin = namespace;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "xbmc"; owner = "xbmc";

View file

@ -1,11 +1,11 @@
{ lib, makeWrapper, buildEnv, kodi, plugins }: { lib, makeWrapper, buildEnv, kodi, addons }:
let let
drvName = builtins.parseDrvName kodi.name; drvName = builtins.parseDrvName kodi.name;
in buildEnv { in buildEnv {
name = "${drvName.name}-with-plugins-${drvName.version}"; name = "${drvName.name}-with-addons-${drvName.version}";
paths = [ kodi ] ++ plugins; paths = [ kodi ] ++ addons;
pathsToLink = [ "/share" ]; pathsToLink = [ "/share" ];
buildInputs = [ makeWrapper ]; buildInputs = [ makeWrapper ];
@ -15,16 +15,16 @@ in buildEnv {
for exe in kodi{,-standalone} for exe in kodi{,-standalone}
do do
makeWrapper ${kodi}/bin/$exe $out/bin/$exe \ makeWrapper ${kodi}/bin/$exe $out/bin/$exe \
--prefix PYTHONPATH : ${kodi.pythonPackages.makePythonPath plugins} \ --prefix PYTHONPATH : ${kodi.pythonPackages.makePythonPath addons} \
--prefix KODI_HOME : $out/share/kodi \ --prefix KODI_HOME : $out/share/kodi \
--prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath --prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
(lib.concatMap (lib.concatMap
(plugin: plugin.extraRuntimeDependencies or []) plugins)}" (plugin: plugin.extraRuntimeDependencies or []) addons)}"
done done
''; '';
meta = kodi.meta // { meta = kodi.meta // {
description = kodi.meta.description description = kodi.meta.description
+ " (with plugins: ${lib.concatMapStringsSep ", " (x: x.name) plugins})"; + " (with addons: ${lib.concatMapStringsSep ", " (x: x.name) addons})";
}; };
} }

View file

@ -780,7 +780,8 @@ mapAliases ({
xara = throw "xara has been removed from nixpkgs. Unmaintained since 2006"; # added 2020-06-24 xara = throw "xara has been removed from nixpkgs. Unmaintained since 2006"; # added 2020-06-24
xbmc = kodi; # added 2018-04-25 xbmc = kodi; # added 2018-04-25
xbmcPlain = kodiPlain; # added 2018-04-25 xbmcPlain = kodiPlain; # added 2018-04-25
xbmcPlugins = kodiPlugins; # added 2018-04-25 xbmcPlugins = kodiPackages; # added 2018-04-25
kodiPlugins = kodiPackages; # added 2021-03-09;
xmonad_log_applet_gnome3 = xmonad_log_applet; # added 2018-05-01 xmonad_log_applet_gnome3 = xmonad_log_applet; # added 2018-05-01
xmpppy = throw "xmpppy has been removed from nixpkgs as it is unmaintained and python2-only"; xmpppy = throw "xmpppy has been removed from nixpkgs as it is unmaintained and python2-only";
pyIRCt = throw "pyIRCt has been removed from nixpkgs as it is unmaintained and python2-only"; pyIRCt = throw "pyIRCt has been removed from nixpkgs as it is unmaintained and python2-only";

View file

@ -26172,7 +26172,7 @@ in
wrapKodi = { kodi }: callPackage ../applications/video/kodi/wrapper.nix { wrapKodi = { kodi }: callPackage ../applications/video/kodi/wrapper.nix {
inherit kodi; inherit kodi;
plugins = let inherit (lib) optional optionals; in with kodiPlugins; addons = let inherit (lib) optional optionals; in with kodiPackages;
([] ([]
++ optional (config.kodi.enableAdvancedLauncher or false) advanced-launcher ++ optional (config.kodi.enableAdvancedLauncher or false) advanced-launcher
++ optional (config.kodi.enableAdvancedEmulatorLauncher or false) ++ optional (config.kodi.enableAdvancedEmulatorLauncher or false)
@ -26264,7 +26264,7 @@ in
useGbm = true; useGbm = true;
}; };
kodiPlugins = recurseIntoAttrs (callPackage ../applications/video/kodi/plugins.nix {}); kodiPackages = recurseIntoAttrs (callPackage ../applications/video/kodi/plugins.nix {});
kodi = wrapKodi { kodi = wrapKodi {
kodi = kodiPlain; kodi = kodiPlain;