From 917f7efdc566170dc7268aa91b02255c5826552e Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Tue, 9 Mar 2021 20:53:45 -0500 Subject: [PATCH 1/9] kodiPlugins: rename to kodiPackages --- pkgs/applications/video/kodi/plugins.nix | 142 ++++++++++++----------- pkgs/applications/video/kodi/wrapper.nix | 12 +- pkgs/top-level/aliases.nix | 3 +- pkgs/top-level/all-packages.nix | 4 +- 4 files changed, 85 insertions(+), 76 deletions(-) diff --git a/pkgs/applications/video/kodi/plugins.nix b/pkgs/applications/video/kodi/plugins.nix index 3aea028e9f0..17c3bde3f5b 100644 --- a/pkgs/applications/video/kodi/plugins.nix +++ b/pkgs/applications/video/kodi/plugins.nix @@ -8,31 +8,31 @@ with lib; let self = rec { - pluginDir = "/share/kodi/addons"; + addonDir = "/share/kodi/addons"; rel = "Matrix"; kodi = kodiPlain; # 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. passthru = (oldAttrs.passthru or {})// { - kodiPluginFor = kodi; - requiredKodiPlugins = requiredKodiPlugins drv.propagatedBuildInputs; + kodiAddonFor = kodi; + requiredKodiAddons = requiredKodiAddons drv.propagatedBuildInputs; }; }); - # Check whether a derivation provides a Kodi plugin. - hasKodiPlugin = drv: drv ? kodiPluginFor && drv.kodiPluginFor == kodi; + # Check whether a derivation provides a Kodi addon. + hasKodiAddon = drv: drv ? kodiAddonFor && drv.kodiAddonFor == kodi; - # Get list of required Kodi plugins given a list of derivations. - requiredKodiPlugins = drvs: let - modules = filter hasKodiPlugin drvs; - in unique (modules ++ concatLists (catAttrs "requiredKodiPlugins" modules)); + # 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)); - kodiWithPlugins = func: callPackage ./wrapper.nix { + kodiWithAddons = func: callPackage ./wrapper.nix { inherit kodi; - plugins = requiredKodiPlugins (func self); + addons = requiredKodiAddons (func self); }; kodi-platform = stdenv.mkDerivation rec { @@ -51,9 +51,13 @@ let self = rec { buildInputs = [ kodiPlain libcec_platform tinyxml ]; }; - mkKodiPlugin = { plugin, namespace, version, sourceDir ? null, ... }@args: - toKodiPlugin (stdenv.mkDerivation ({ - name = "kodi-plugin-${plugin}-${version}"; + buildKodiAddon = + { name ? "${attrs.pname}-${attrs.version}" + , namespace + , sourceDir ? null + , ... } @ attrs: + toKodiAddon (stdenv.mkDerivation ({ + name = "kodi-" + name; dontStrip = true; @@ -61,18 +65,23 @@ let self = rec { installPhase = '' ${if sourceDir == null then "" else "cd $src/$sourceDir"} - d=$out${pluginDir}/${namespace} + d=$out${addonDir}/${namespace} mkdir -p $d sauce="." [ -d ${namespace} ] && sauce=${namespace} cp -R "$sauce/"* $d ''; - } // args)); + } // attrs)); - mkKodiABIPlugin = { plugin, namespace, version, extraBuildInputs ? [], - extraRuntimeDependencies ? [], extraInstallPhase ? "", ... }@args: - toKodiPlugin (stdenv.mkDerivation ({ - name = "kodi-plugin-${plugin}-${version}"; + buildKodiBinaryAddon = + { name ? "${attrs.pname}-${attrs.version}" + , namespace + , version + , extraBuildInputs ? [] + , extraRuntimeDependencies ? [] + , extraInstallPhase ? "", ... } @ attrs: + toKodiAddon (stdenv.mkDerivation ({ + name = "kodi-" + name; dontStrip = true; @@ -86,25 +95,25 @@ let self = rec { "-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 # 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${pluginDir}/${n}/${n}.so.${version} + ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version} ${extraInstallPhase} ''; - } // args)); + } // attrs)); - advanced-launcher = mkKodiPlugin rec { + advanced-launcher = buildKodiAddon rec { - plugin = "advanced-launcher"; + pname = "advanced-launcher"; namespace = "plugin.program.advanced.launcher"; version = "2.5.8"; src = fetchFromGitHub { owner = "edwtjo"; - repo = plugin; + repo = pname; rev = version; 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"; version = "0.9.6"; @@ -175,8 +184,8 @@ let self = rec { }; mkController = controller: { - ${controller} = mkKodiPlugin rec { - plugin = pname + "-" + controller; + ${controller} = buildKodiAddon rec { + pname = pname + "-" + controller; namespace = "game.controller." + controller; sourceDir = "addons/" + namespace; inherit version src meta; @@ -209,23 +218,22 @@ let self = rec { broken = true; # requires port to python3 }; in { - service = mkKodiPlugin { - plugin = pname + "-service"; + service = buildKodiAddon { + pname = pname + "-service"; version = "1.2.1"; namespace = "service.hyper.launcher"; inherit src meta; }; - plugin = mkKodiPlugin { - plugin = pname; + plugin = buildKodiAddon { namespace = "plugin.hyper.launcher"; - inherit version src meta; + inherit pname version src meta; }; }; - joystick = mkKodiABIPlugin rec { + joystick = buildKodiBinaryAddon rec { + pname = namespace; namespace = "peripheral.joystick"; version = "1.7.1"; - plugin = namespace; src = fetchFromGitHub { owner = "xbmc"; @@ -243,8 +251,8 @@ let self = rec { extraBuildInputs = [ tinyxml udev ]; }; - simpleplugin = mkKodiPlugin rec { - plugin = "simpleplugin"; + simpleplugin = buildKodiAddon rec { + pname = "simpleplugin"; namespace = "script.module.simpleplugin"; 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"; version = "5.1.12"; src = fetchFromGitHub { - name = plugin + "-" + version + ".tar.gz"; + name = pname + "-" + version + ".tar.gz"; owner = "nilzen"; - repo = "xbmc-" + plugin; + repo = "xbmc-" + pname; rev = "v${version}"; sha256 = "04j1nhm7mh9chs995lz6bv1vsq5xzk7a7c0lmk4bnfv8jrfpj0w6"; }; @@ -292,10 +300,10 @@ let self = rec { }; - steam-controller = mkKodiABIPlugin rec { + steam-controller = buildKodiBinaryAddon rec { + pname = namespace; namespace = "peripheral.steamcontroller"; version = "0.11.0"; - plugin = namespace; src = fetchFromGitHub { 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"; version = "3.5.1"; @@ -343,8 +351,8 @@ let self = rec { }; }; - pdfreader = mkKodiPlugin rec { - plugin = "pdfreader"; + pdfreader = buildKodiAddon rec { + pname = "pdfreader"; namespace = "plugin.image.pdf"; 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"; 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"; 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"; version = "7.4.2"; @@ -432,9 +440,9 @@ let self = rec { extraBuildInputs = [ zlib pugixml ]; }; - osmc-skin = mkKodiPlugin rec { + osmc-skin = buildKodiAddon rec { - plugin = "osmc-skin"; + pname = "osmc-skin"; namespace = "skin.osmc"; version = "18.0.0"; @@ -454,8 +462,8 @@ let self = rec { }; }; - yatp = python3Packages.toPythonModule (mkKodiPlugin rec { - plugin = "yatp"; + yatp = python3Packages.toPythonModule (buildKodiAddon rec { + pname = "yatp"; namespace = "plugin.video.yatp"; 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"; version = "2.6.7"; @@ -500,7 +508,7 @@ let self = rec { extraRuntimeDependencies = [ glib nspr nss stdenv.cc.cc.lib ]; 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 = { @@ -511,10 +519,10 @@ let self = rec { }; }; - vfs-sftp = mkKodiABIPlugin rec { + vfs-sftp = buildKodiBinaryAddon rec { + pname = namespace; namespace = "vfs.sftp"; version = "2.0.0"; - plugin = namespace; src = fetchFromGitHub { owner = "xbmc"; @@ -533,10 +541,10 @@ let self = rec { extraBuildInputs = [ openssl libssh zlib ]; }; - vfs-libarchive = mkKodiABIPlugin rec { + vfs-libarchive = buildKodiBinaryAddon rec { + pname = namespace; namespace = "vfs.libarchive"; version = "2.0.0"; - plugin = namespace; src = fetchFromGitHub { owner = "xbmc"; diff --git a/pkgs/applications/video/kodi/wrapper.nix b/pkgs/applications/video/kodi/wrapper.nix index 80a36df3de7..d4844703b6b 100644 --- a/pkgs/applications/video/kodi/wrapper.nix +++ b/pkgs/applications/video/kodi/wrapper.nix @@ -1,11 +1,11 @@ -{ lib, makeWrapper, buildEnv, kodi, plugins }: +{ lib, makeWrapper, buildEnv, kodi, addons }: let drvName = builtins.parseDrvName kodi.name; in buildEnv { - name = "${drvName.name}-with-plugins-${drvName.version}"; + name = "${drvName.name}-with-addons-${drvName.version}"; - paths = [ kodi ] ++ plugins; + paths = [ kodi ] ++ addons; pathsToLink = [ "/share" ]; buildInputs = [ makeWrapper ]; @@ -15,16 +15,16 @@ in buildEnv { for exe in kodi{,-standalone} do 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 LD_LIBRARY_PATH ":" "${lib.makeLibraryPath (lib.concatMap - (plugin: plugin.extraRuntimeDependencies or []) plugins)}" + (plugin: plugin.extraRuntimeDependencies or []) addons)}" done ''; meta = kodi.meta // { description = kodi.meta.description - + " (with plugins: ${lib.concatMapStringsSep ", " (x: x.name) plugins})"; + + " (with addons: ${lib.concatMapStringsSep ", " (x: x.name) addons})"; }; } diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 6036e421683..2bb4dde49dc 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -780,7 +780,8 @@ mapAliases ({ xara = throw "xara has been removed from nixpkgs. Unmaintained since 2006"; # added 2020-06-24 xbmc = kodi; # 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 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"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 72fdc8cbbc4..76962613328 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26172,7 +26172,7 @@ in wrapKodi = { kodi }: callPackage ../applications/video/kodi/wrapper.nix { 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.enableAdvancedEmulatorLauncher or false) @@ -26264,7 +26264,7 @@ in useGbm = true; }; - kodiPlugins = recurseIntoAttrs (callPackage ../applications/video/kodi/plugins.nix {}); + kodiPackages = recurseIntoAttrs (callPackage ../applications/video/kodi/plugins.nix {}); kodi = wrapKodi { kodi = kodiPlain; From 3a70d376fe2eee71d0266141528d5aab2524db46 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Tue, 9 Mar 2021 21:16:31 -0500 Subject: [PATCH 2/9] kodiPackages: rename plugins.nix to packages.nix --- pkgs/applications/video/kodi/{plugins.nix => packages.nix} | 0 pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/applications/video/kodi/{plugins.nix => packages.nix} (100%) diff --git a/pkgs/applications/video/kodi/plugins.nix b/pkgs/applications/video/kodi/packages.nix similarity index 100% rename from pkgs/applications/video/kodi/plugins.nix rename to pkgs/applications/video/kodi/packages.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 76962613328..23a90d2b045 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26264,7 +26264,7 @@ in useGbm = true; }; - kodiPackages = recurseIntoAttrs (callPackage ../applications/video/kodi/plugins.nix {}); + kodiPackages = recurseIntoAttrs (callPackage ../applications/video/kodi/packages.nix {}); kodi = wrapKodi { kodi = kodiPlain; From f8f037b51d7d98c901e2e686a8af71389ea22f69 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Tue, 9 Mar 2021 22:26:59 -0500 Subject: [PATCH 3/9] kodiPlain: rename default.nix to unwrapped.nix --- pkgs/applications/video/kodi/{default.nix => unwrapped.nix} | 0 pkgs/top-level/all-packages.nix | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename pkgs/applications/video/kodi/{default.nix => unwrapped.nix} (100%) diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/unwrapped.nix similarity index 100% rename from pkgs/applications/video/kodi/default.nix rename to pkgs/applications/video/kodi/unwrapped.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 23a90d2b045..558d6850111 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26254,13 +26254,13 @@ in gtk = gtk2; }; - kodiPlain = callPackage ../applications/video/kodi { }; + kodiPlain = callPackage ../applications/video/kodi/unwrapped.nix { }; - kodiPlainWayland = callPackage ../applications/video/kodi { + kodiPlainWayland = callPackage ../applications/video/kodi/unwrapped.nix { useWayland = true; }; - kodiGBM = callPackage ../applications/video/kodi { + kodiGBM = callPackage ../applications/video/kodi/unwrapped.nix { useGbm = true; }; From 587a8b28370ea46b8fdc3bd74d8017e2681e9982 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Tue, 9 Mar 2021 22:47:47 -0500 Subject: [PATCH 4/9] kodi: drop wrapKodi function and disregard config.kodi.* options --- pkgs/applications/video/kodi/packages.nix | 13 ++---- pkgs/top-level/aliases.nix | 3 ++ pkgs/top-level/all-packages.nix | 49 +++-------------------- 3 files changed, 12 insertions(+), 53 deletions(-) diff --git a/pkgs/applications/video/kodi/packages.nix b/pkgs/applications/video/kodi/packages.nix index 17c3bde3f5b..1bcbaaa4b16 100644 --- a/pkgs/applications/video/kodi/packages.nix +++ b/pkgs/applications/video/kodi/packages.nix @@ -1,5 +1,5 @@ { lib, stdenv, callPackage, fetchFromGitHub -, cmake, kodiPlain, libcec_platform, tinyxml, pugixml +, cmake, kodi, libcec_platform, tinyxml, pugixml , steam, udev, libusb1, jsoncpp, libhdhomerun, zlib , python3Packages, expat, glib, nspr, nss, openssl , libssh, libarchive, lzma, bzip2, lz4, lzo }: @@ -11,7 +11,7 @@ let self = rec { addonDir = "/share/kodi/addons"; rel = "Matrix"; - kodi = kodiPlain; + inherit kodi; # Convert derivation to a kodi module. Stolen from ../../../top-level/python-packages.nix toKodiAddon = drv: drv.overrideAttrs(oldAttrs: { @@ -30,11 +30,6 @@ let self = rec { modules = filter hasKodiAddon drvs; in unique (modules ++ concatLists (catAttrs "requiredKodiAddons" modules)); - kodiWithAddons = func: callPackage ./wrapper.nix { - inherit kodi; - addons = requiredKodiAddons (func self); - }; - kodi-platform = stdenv.mkDerivation rec { project = "kodi-platform"; version = "17.1"; @@ -48,7 +43,7 @@ let self = rec { }; nativeBuildInputs = [ cmake ]; - buildInputs = [ kodiPlain libcec_platform tinyxml ]; + buildInputs = [ kodi libcec_platform tinyxml ]; }; buildKodiAddon = @@ -86,7 +81,7 @@ let self = rec { dontStrip = true; nativeBuildInputs = [ cmake ]; - buildInputs = [ kodiPlain kodi-platform libcec_platform ] ++ extraBuildInputs; + buildInputs = [ kodi kodi-platform libcec_platform ] ++ extraBuildInputs; inherit extraRuntimeDependencies; diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 2bb4dde49dc..53a769c461d 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -303,6 +303,9 @@ mapAliases ({ json_glib = json-glib; # added 2018-02-25 kdecoration-viewer = throw "kdecoration-viewer has been removed from nixpkgs, as there is no upstream activity"; # 2020-06-16 k9copy = throw "k9copy has been removed from nixpkgs, as there is no upstream activity"; # 2020-11-06 + kodiGBM = kodi-gbm; + kodiPlain = kodi; + kodiPlainWayland = kodi-wayland; julia_07 = throw "julia_07 is deprecated in favor of julia_10 LTS"; # added 2020-09-15 julia_11 = throw "julia_11 is deprecated in favor of latest Julia version"; # added 2020-09-15 kdeconnect = plasma5Packages.kdeconnect-kde; # added 2020-10-28 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 558d6850111..8561ef7e3f4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26170,33 +26170,6 @@ in cores = retroArchCores; }; - wrapKodi = { kodi }: callPackage ../applications/video/kodi/wrapper.nix { - inherit kodi; - addons = let inherit (lib) optional optionals; in with kodiPackages; - ([] - ++ optional (config.kodi.enableAdvancedLauncher or false) advanced-launcher - ++ optional (config.kodi.enableAdvancedEmulatorLauncher or false) - advanced-emulator-launcher - ++ optionals (config.kodi.enableControllers or false) - (with controllers; - [ default dreamcast gba genesis mouse n64 nes ps snes ]) - ++ optional (config.kodi.enableExodus or false) exodus - ++ optionals (config.kodi.enableHyperLauncher or false) - (with hyper-launcher; [ plugin service pdfreader ]) - ++ optional (config.kodi.enableJoystick or false) joystick - ++ optional (config.kodi.enableOSMCskin or false) osmc-skin - ++ optional (config.kodi.enableSVTPlay or false) svtplay - ++ optional (config.kodi.enableSteamController or false) steam-controller - ++ optional (config.kodi.enableSteamLauncher or false) steam-launcher - ++ optional (config.kodi.enablePVRHTS or false) pvr-hts - ++ optional (config.kodi.enablePVRHDHomeRun or false) pvr-hdhomerun - ++ optional (config.kodi.enablePVRIPTVSimple or false) pvr-iptvsimple - ++ optional (config.kodi.enableInputStreamAdaptive or false) inputstream-adaptive - ++ optional (config.kodi.enableVFSSFTP or false) vfs-sftp - ++ optional (config.kodi.enableVFSLibarchive or false) vfs-libarchive - ); - }; - wsjtx = qt5.callPackage ../applications/radio/wsjtx { }; wxhexeditor = callPackage ../applications/editors/wxhexeditor { @@ -26254,30 +26227,18 @@ in gtk = gtk2; }; - kodiPlain = callPackage ../applications/video/kodi/unwrapped.nix { }; + kodiPackages = recurseIntoAttrs (callPackage ../applications/video/kodi/packages.nix {}); - kodiPlainWayland = callPackage ../applications/video/kodi/unwrapped.nix { + kodi = callPackage ../applications/video/kodi/unwrapped.nix { }; + + kodi-wayland = callPackage ../applications/video/kodi/unwrapped.nix { useWayland = true; }; - kodiGBM = callPackage ../applications/video/kodi/unwrapped.nix { + kodi-gbm = callPackage ../applications/video/kodi/unwrapped.nix { useGbm = true; }; - kodiPackages = recurseIntoAttrs (callPackage ../applications/video/kodi/packages.nix {}); - - kodi = wrapKodi { - kodi = kodiPlain; - }; - - kodi-wayland = wrapKodi { - kodi = kodiPlainWayland; - }; - - kodi-gbm = wrapKodi { - kodi = kodiGBM; - }; - kodi-cli = callPackage ../tools/misc/kodi-cli { }; kodi-retroarch-advanced-launchers = From ce0621ec4f8b2de17ed8e4c96f8a295336989c50 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 10 Mar 2021 08:16:10 -0500 Subject: [PATCH 5/9] kodi: introduce kodi.withPackages to replace kodiPackages.kodiWithAddons --- pkgs/applications/video/kodi/default.nix | 14 ++++++++++++++ pkgs/applications/video/kodi/wrapper.nix | 11 ++--------- pkgs/top-level/all-packages.nix | 8 ++++---- 3 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 pkgs/applications/video/kodi/default.nix diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/default.nix new file mode 100644 index 00000000000..55ba84cc454 --- /dev/null +++ b/pkgs/applications/video/kodi/default.nix @@ -0,0 +1,14 @@ +{ callPackage, ... } @ args: +let + unwrapped = callPackage ./unwrapped.nix (removeAttrs args [ "callPackage" ]); + kodiPackages = callPackage ./packages.nix { kodi = unwrapped; }; +in + unwrapped.overrideAttrs (oldAttrs: { + passthru = oldAttrs.passthru // { + packages = kodiPackages; + withPackages = func: callPackage ./wrapper.nix { + kodi = unwrapped; + addons = kodiPackages.requiredKodiAddons (func kodiPackages); + }; + }; + }) diff --git a/pkgs/applications/video/kodi/wrapper.nix b/pkgs/applications/video/kodi/wrapper.nix index d4844703b6b..2b4abbb500a 100644 --- a/pkgs/applications/video/kodi/wrapper.nix +++ b/pkgs/applications/video/kodi/wrapper.nix @@ -1,9 +1,7 @@ { lib, makeWrapper, buildEnv, kodi, addons }: -let - drvName = builtins.parseDrvName kodi.name; -in buildEnv { - name = "${drvName.name}-with-addons-${drvName.version}"; +buildEnv { + name = "${kodi.name}-env"; paths = [ kodi ] ++ addons; pathsToLink = [ "/share" ]; @@ -22,9 +20,4 @@ in buildEnv { (plugin: plugin.extraRuntimeDependencies or []) addons)}" done ''; - - meta = kodi.meta // { - description = kodi.meta.description - + " (with addons: ${lib.concatMapStringsSep ", " (x: x.name) addons})"; - }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8561ef7e3f4..f26d220c087 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26227,15 +26227,15 @@ in gtk = gtk2; }; - kodiPackages = recurseIntoAttrs (callPackage ../applications/video/kodi/packages.nix {}); + kodiPackages = recurseIntoAttrs (kodi.packages); - kodi = callPackage ../applications/video/kodi/unwrapped.nix { }; + kodi = callPackage ../applications/video/kodi { }; - kodi-wayland = callPackage ../applications/video/kodi/unwrapped.nix { + kodi-wayland = callPackage ../applications/video/kodi { useWayland = true; }; - kodi-gbm = callPackage ../applications/video/kodi/unwrapped.nix { + kodi-gbm = callPackage ../applications/video/kodi { useGbm = true; }; From 4ef33dd12d508a1f459283ca23bd03d1a36ac71a Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 10 Mar 2021 20:04:23 -0500 Subject: [PATCH 6/9] kodi: rename useWayland and useGbm flags to waylandSupport and gbmSupport --- pkgs/applications/video/kodi/unwrapped.nix | 25 +++++++++++----------- pkgs/top-level/all-packages.nix | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/video/kodi/unwrapped.nix b/pkgs/applications/video/kodi/unwrapped.nix index da338e17586..d1a451f7b61 100644 --- a/pkgs/applications/video/kodi/unwrapped.nix +++ b/pkgs/applications/video/kodi/unwrapped.nix @@ -28,9 +28,9 @@ , udevSupport ? true, udev ? null , usbSupport ? false, libusb-compat-0_1 ? null , vdpauSupport ? true, libvdpau ? null -, useWayland ? false, wayland ? null, wayland-protocols ? null +, waylandSupport ? false, wayland ? null, wayland-protocols ? null , waylandpp ? null, libxkbcommon ? null -, useGbm ? false, mesa ? null, libinput ? null +, gbmSupport ? false, mesa ? null, libinput ? null , buildPackages }: @@ -42,8 +42,8 @@ assert sambaSupport -> samba != null; assert udevSupport -> udev != null; assert usbSupport -> libusb-compat-0_1 != null && ! udevSupport; # libusb-compat-0_1 won't be used if udev is avaliable assert vdpauSupport -> libvdpau != null; -assert useWayland -> wayland != null && wayland-protocols != null && waylandpp != null && libxkbcommon != null; -assert useGbm || useWayland || x11Support; +assert waylandSupport -> wayland != null && wayland-protocols != null && waylandpp != null && libxkbcommon != null; +assert gbmSupport || waylandSupport || x11Support; let kodiReleaseDate = "20210219"; @@ -106,13 +106,14 @@ let }; kodi_platforms = - lib.optional useGbm "gbm" ++ - lib.optional useWayland "wayland" ++ + lib.optional gbmSupport "gbm" ++ + lib.optional waylandSupport "wayland" ++ lib.optional x11Support "x11" ; in stdenv.mkDerivation { - name = "kodi-${lib.optionalString useWayland "wayland-"}${kodiVersion}"; + pname = "kodi"; + version = kodiVersion; src = kodi_src; @@ -150,14 +151,14 @@ in stdenv.mkDerivation { ++ lib.optional udevSupport udev ++ lib.optional usbSupport libusb-compat-0_1 ++ lib.optional vdpauSupport libvdpau - ++ lib.optionals useWayland [ + ++ lib.optionals waylandSupport [ wayland waylandpp.dev wayland-protocols # Not sure why ".dev" is needed here, but CMake doesn't find libxkbcommon otherwise libxkbcommon.dev ] - ++ lib.optional useGbm [ + ++ lib.optional gbmSupport [ libxkbcommon.dev mesa.dev libinput.dev @@ -174,14 +175,14 @@ in stdenv.mkDerivation { # for TexturePacker giflib zlib libpng libjpeg lzo - ] ++ lib.optionals useWayland [ wayland-protocols waylandpp.bin ]; + ] ++ lib.optionals waylandSupport [ wayland-protocols waylandpp.bin ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; cmakeFlags = [ - "-DAPP_RENDER_SYSTEM=${if useGbm then "gles" else "gl"}" + "-DAPP_RENDER_SYSTEM=${if gbmSupport then "gles" else "gl"}" "-Dlibdvdcss_URL=${libdvdcss}" "-Dlibdvdnav_URL=${libdvdnav}" "-Dlibdvdread_URL=${libdvdread}" @@ -193,7 +194,7 @@ in stdenv.mkDerivation { "-DSWIG_EXECUTABLE=${buildPackages.swig}/bin/swig" "-DFLATBUFFERS_FLATC_EXECUTABLE=${buildPackages.flatbuffers}/bin/flatc" "-DPYTHON_EXECUTABLE=${buildPackages.python3Packages.python}/bin/python" - ] ++ lib.optional useWayland [ + ] ++ lib.optional waylandSupport [ "-DWAYLANDPP_SCANNER=${buildPackages.waylandpp}/bin/wayland-scanner++" ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f26d220c087..49727f52fb2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26232,11 +26232,11 @@ in kodi = callPackage ../applications/video/kodi { }; kodi-wayland = callPackage ../applications/video/kodi { - useWayland = true; + waylandSupport = true; }; kodi-gbm = callPackage ../applications/video/kodi { - useGbm = true; + gbmSupport = true; }; kodi-cli = callPackage ../tools/misc/kodi-cli { }; From 901b43d439db00e3e03f969ffb2df0530ef8bf17 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 10 Mar 2021 21:27:38 -0500 Subject: [PATCH 7/9] kodi: miscellaneous cleanup Co-authored-by: Sandro --- pkgs/applications/video/kodi/packages.nix | 4 +- pkgs/applications/video/kodi/unwrapped.nix | 51 +++++++++------------- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/pkgs/applications/video/kodi/packages.nix b/pkgs/applications/video/kodi/packages.nix index 1bcbaaa4b16..8e0ecbf9b9b 100644 --- a/pkgs/applications/video/kodi/packages.nix +++ b/pkgs/applications/video/kodi/packages.nix @@ -49,7 +49,7 @@ let self = rec { buildKodiAddon = { name ? "${attrs.pname}-${attrs.version}" , namespace - , sourceDir ? null + , sourceDir ? "" , ... } @ attrs: toKodiAddon (stdenv.mkDerivation ({ name = "kodi-" + name; @@ -59,7 +59,7 @@ let self = rec { extraRuntimeDependencies = [ ]; installPhase = '' - ${if sourceDir == null then "" else "cd $src/$sourceDir"} + cd $src/$sourceDir d=$out${addonDir}/${namespace} mkdir -p $d sauce="." diff --git a/pkgs/applications/video/kodi/unwrapped.nix b/pkgs/applications/video/kodi/unwrapped.nix index d1a451f7b61..2a713324c3f 100644 --- a/pkgs/applications/video/kodi/unwrapped.nix +++ b/pkgs/applications/video/kodi/unwrapped.nix @@ -19,30 +19,22 @@ , libplist, p11-kit, zlib, flatbuffers, fmt, fstrcmp, rapidjson , lirc , x11Support ? true, libX11, xorgproto, libXt, libXmu, libXext, libXinerama, libXrandr, libXtst, libXfixes, xdpyinfo, libXdmcp -, dbusSupport ? true, dbus ? null -, joystickSupport ? true, cwiid ? null -, nfsSupport ? true, libnfs ? null -, pulseSupport ? true, libpulseaudio ? null -, rtmpSupport ? true, rtmpdump ? null -, sambaSupport ? true, samba ? null -, udevSupport ? true, udev ? null -, usbSupport ? false, libusb-compat-0_1 ? null -, vdpauSupport ? true, libvdpau ? null -, waylandSupport ? false, wayland ? null, wayland-protocols ? null -, waylandpp ? null, libxkbcommon ? null -, gbmSupport ? false, mesa ? null, libinput ? null +, dbusSupport ? true, dbus +, joystickSupport ? true, cwiid +, nfsSupport ? true, libnfs +, pulseSupport ? true, libpulseaudio +, rtmpSupport ? true, rtmpdump +, sambaSupport ? true, samba +, udevSupport ? true, udev +, usbSupport ? false, libusb-compat-0_1 +, vdpauSupport ? true, libvdpau +, waylandSupport ? false, wayland, wayland-protocols +, waylandpp ? null, libxkbcommon +, gbmSupport ? false, mesa, libinput , buildPackages }: -assert dbusSupport -> dbus != null; -assert nfsSupport -> libnfs != null; -assert pulseSupport -> libpulseaudio != null; -assert rtmpSupport -> rtmpdump != null; -assert sambaSupport -> samba != null; -assert udevSupport -> udev != null; -assert usbSupport -> libusb-compat-0_1 != null && ! udevSupport; # libusb-compat-0_1 won't be used if udev is avaliable -assert vdpauSupport -> libvdpau != null; -assert waylandSupport -> wayland != null && wayland-protocols != null && waylandpp != null && libxkbcommon != null; +assert usbSupport -> !udevSupport; # libusb-compat-0_1 won't be used if udev is avaliable assert gbmSupport || waylandSupport || x11Support; let @@ -78,7 +70,7 @@ let "-DPKG_CONFIG_EXECUTABLE=pkg-config" ]; buildInputs = [ libidn libtasn1 p11-kit zlib libva ] - ++ lib.optional vdpauSupport libvdpau; + ++ lib.optional vdpauSupport libvdpau; nativeBuildInputs = [ cmake nasm pkg-config gnutls ]; }; @@ -105,11 +97,9 @@ let sha256 = "1xxn01mhkdnp10cqdr357wx77vyzfb5glqpqyg8m0skyi75aii59"; }; - kodi_platforms = - lib.optional gbmSupport "gbm" ++ - lib.optional waylandSupport "wayland" ++ - lib.optional x11Support "x11" - ; + kodi_platforms = lib.optional gbmSupport "gbm" + ++ lib.optional waylandSupport "wayland" + ++ lib.optional x11Support "x11"; in stdenv.mkDerivation { pname = "kodi"; @@ -143,7 +133,7 @@ in stdenv.mkDerivation { libXinerama libXrandr.dev libXtst libXfixes ] ++ lib.optional dbusSupport dbus - ++ lib.optional joystickSupport cwiid + ++ lib.optional joystickSupport cwiid ++ lib.optional nfsSupport libnfs ++ lib.optional pulseSupport libpulseaudio ++ lib.optional rtmpSupport rtmpdump @@ -222,7 +212,8 @@ in stdenv.mkDerivation { postInstall = '' for p in $(ls $out/bin/) ; do wrapProgram $out/bin/$p \ - --prefix PATH ":" "${lib.makeBinPath ([ python3Packages.python glxinfo ] ++ lib.optional x11Support xdpyinfo ++ lib.optional sambaSupport samba)}" \ + --prefix PATH ":" "${lib.makeBinPath ([ python3Packages.python glxinfo ] + ++ lib.optional x11Support xdpyinfo ++ lib.optional sambaSupport samba)}" \ --prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath ([ curl systemd libmad libvdpau libcec libcec_platform libass ] ++ lib.optional nfsSupport libnfs @@ -244,7 +235,7 @@ in stdenv.mkDerivation { meta = with lib; { description = "Media center"; homepage = "https://kodi.tv/"; - license = licenses.gpl2; + license = licenses.gpl2Plus; platforms = platforms.linux; maintainers = with maintainers; [ titanous edwtjo peterhoeg sephalon ]; }; From 4769eb4f58c30c004e0e2acc60f1d5f7f1503130 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Thu, 11 Mar 2021 19:52:33 -0500 Subject: [PATCH 8/9] kodi: add release notes for kodi.withPackages --- nixos/doc/manual/release-notes/rl-2105.xml | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2105.xml b/nixos/doc/manual/release-notes/rl-2105.xml index e052632ecaf..7e5505e588a 100644 --- a/nixos/doc/manual/release-notes/rl-2105.xml +++ b/nixos/doc/manual/release-notes/rl-2105.xml @@ -577,6 +577,37 @@ self: super: for your Kafka version. + + + The kodi package has been modified to allow concise addon management. Consider + the following configuration from previous releases of NixOS to install kodi, + including the kodiPackages.inputstream-adaptive and kodiPackages.vfs-sftp + addons: + + +environment.systemPackages = [ + pkgs.kodi +]; + +nixpkgs.config.kodi = { + enableInputStreamAdaptive = true; + enableVFSSFTP = true; +}; + + + All Kodi config flags have been removed, and as a result the above configuration + should now be written as: + + +environment.systemPackages = [ + (pkgs.kodi.withPackages (p: with p; [ + inputstream-adaptive + vfs-sftp + ])) +]; + + + From 696ac06a933d590369ee78192024dc5467e96e88 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Thu, 11 Mar 2021 19:58:39 -0500 Subject: [PATCH 9/9] kodi: add release notes for version 19.0 update --- nixos/doc/manual/release-notes/rl-2105.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2105.xml b/nixos/doc/manual/release-notes/rl-2105.xml index 7e5505e588a..af488143724 100644 --- a/nixos/doc/manual/release-notes/rl-2105.xml +++ b/nixos/doc/manual/release-notes/rl-2105.xml @@ -57,6 +57,13 @@ for the motivation). + + + Kodi has been updated to version 19.0 "Matrix". See + the announcement for + further details. + +