From 5935bf4daf8b18e937d68400b80974acc03753a6 Mon Sep 17 00:00:00 2001 From: Daniel Wagenknecht Date: Fri, 6 Jan 2023 22:47:10 +0100 Subject: [PATCH 1/4] kodi: use mkDerivation with finalAttrs This pattern allows for easier overriding of the derivations attributes like described and discussed in #119942. In this context - adapt the handling of the version and revision handling so overriding it gets reflected in the version string that kodi displays in the UI - make the bundled dependencies available for overriding - make some of the existing compilation flags to be overridable consistently with existing options --- pkgs/applications/video/kodi/unwrapped.nix | 46 +++++++++++++--------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/pkgs/applications/video/kodi/unwrapped.nix b/pkgs/applications/video/kodi/unwrapped.nix index f1e11c1d80e6..517b00bd2c8b 100644 --- a/pkgs/applications/video/kodi/unwrapped.nix +++ b/pkgs/applications/video/kodi/unwrapped.nix @@ -28,6 +28,7 @@ , rtmpSupport ? true, rtmpdump , sambaSupport ? true, samba , udevSupport ? true, udev +, opticalSupport ? true , usbSupport ? false, libusb-compat-0_1 , vdpauSupport ? true, libvdpau , waylandSupport ? false, wayland, wayland-protocols @@ -40,10 +41,6 @@ assert usbSupport -> !udevSupport; # libusb-compat-0_1 won't be used if udev is assert gbmSupport || waylandSupport || x11Support; let - kodiReleaseDate = "20240405"; - kodiVersion = "21.0"; - rel = "Omega"; - # see https://github.com/xbmc/xbmc/blob/${kodiVersion}-${rel}/tools/depends/target/ to get suggested versions for all dependencies # We can build these externally but FindLibDvd.cmake forces us to build it @@ -88,17 +85,23 @@ let ++ lib.optional waylandSupport "wayland" ++ lib.optional x11Support "x11"; -in stdenv.mkDerivation { +in stdenv.mkDerivation (finalAttrs: { pname = "kodi"; - version = kodiVersion; + version = "21.0"; + kodiReleaseName = "Omega"; src = fetchFromGitHub { owner = "xbmc"; - repo = "xbmc"; - rev = "${kodiVersion}-${rel}"; - hash = "sha256-xrFWqgwTkurEwt3/+/e4SCM6Uk9nxuW62SrCFWWqZO0="; + repo = "xbmc"; + rev = "${finalAttrs.version}-${finalAttrs.kodiReleaseName}"; + hash = "sha256-xrFWqgwTkurEwt3/+/e4SCM6Uk9nxuW62SrCFWWqZO0="; }; + # make derivations declared in the let binding available here, so + # they can be overridden + inherit libdvdcss libdvdnav libdvdread groovy + apache_commons_lang apache_commons_text; + buildInputs = [ gnutls libidn2 libtasn1 nasm p11-kit libxml2 python3Packages.python @@ -168,17 +171,20 @@ in stdenv.mkDerivation { cmakeFlags = [ "-DAPP_RENDER_SYSTEM=${if gbmSupport then "gles" else "gl"}" - "-Dlibdvdcss_URL=${libdvdcss}" - "-Dlibdvdnav_URL=${libdvdnav}" - "-Dlibdvdread_URL=${libdvdread}" - "-Dgroovy_SOURCE_DIR=${groovy}" - "-Dapache-commons-lang_SOURCE_DIR=${apache_commons_lang}" - "-Dapache-commons-text_SOURCE_DIR=${apache_commons_text}" - "-DGIT_VERSION=${kodiReleaseDate}" + "-Dlibdvdcss_URL=${finalAttrs.libdvdcss}" + "-Dlibdvdnav_URL=${finalAttrs.libdvdnav}" + "-Dlibdvdread_URL=${finalAttrs.libdvdread}" + "-Dgroovy_SOURCE_DIR=${finalAttrs.groovy}" + "-Dapache-commons-lang_SOURCE_DIR=${finalAttrs.apache_commons_lang}" + "-Dapache-commons-text_SOURCE_DIR=${finalAttrs.apache_commons_text}" + # Upstream derives this from the git HEADs hash and date. + # LibreElec (minimal distro for kodi) uses the equivalent to this. + "-DGIT_VERSION=${finalAttrs.version}-${finalAttrs.kodiReleaseName}" "-DENABLE_EVENTCLIENTS=ON" "-DENABLE_INTERNAL_CROSSGUID=OFF" "-DENABLE_INTERNAL_RapidJSON=OFF" - "-DENABLE_OPTICAL=ON" + "-DENABLE_OPTICAL=${if opticalSupport then "ON" else "OFF"}" + "-DENABLE_VDPAU=${if vdpauSupport then "ON" else "OFF"}" "-DLIRC_DEVICE=/run/lirc/lircd" "-DSWIG_EXECUTABLE=${buildPackages.swig}/bin/swig" "-DFLATBUFFERS_FLATC_EXECUTABLE=${buildPackages.flatbuffers}/bin/flatc" @@ -221,7 +227,8 @@ in stdenv.mkDerivation { --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 ] + ([ curl systemd libmad libcec libcec_platform libass ] + ++ lib.optional vdpauSupport libvdpau ++ lib.optional nfsSupport libnfs ++ lib.optional rtmpSupport rtmpdump)}" done @@ -240,6 +247,7 @@ in stdenv.mkDerivation { passthru = { pythonPackages = python3Packages; ffmpeg = ffmpeg; + kodi = finalAttrs.finalPackage; }; meta = with lib; { @@ -249,4 +257,4 @@ in stdenv.mkDerivation { platforms = platforms.linux; maintainers = teams.kodi.members; }; -} +}) From 2511f48e1ccff1c2f7c17b405a861f729aa2b4bf Mon Sep 17 00:00:00 2001 From: Daniel Wagenknecht Date: Fri, 6 Jan 2023 23:11:59 +0100 Subject: [PATCH 2/4] kodi: make withPackages and overrideAttrs composable Using withPackage on a kodi derivation that was modified with overrideAttrs lead to the modifications being discarded. With the previous adaptions to the kodi derivation we can now modify the wrapper that allows using both overrideAttrs and withPackage to form a custom kodi derivation with plugins. --- pkgs/applications/video/kodi/default.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/default.nix index 3f382efff11b..b028558a61da 100644 --- a/pkgs/applications/video/kodi/default.nix +++ b/pkgs/applications/video/kodi/default.nix @@ -1,14 +1,18 @@ { callPackage, ... } @ args: let unwrapped = callPackage ./unwrapped.nix (removeAttrs args [ "callPackage" ]); - kodiPackages = callPackage ../../../top-level/kodi-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); - }; - }; + passthru = + let + finalKodi = oldAttrs.passthru.kodi; + kodiPackages = callPackage ../../../top-level/kodi-packages.nix { kodi = finalKodi; }; + in + oldAttrs.passthru // { + packages = kodiPackages; + withPackages = func: callPackage ./wrapper.nix { + kodi = finalKodi; + addons = kodiPackages.requiredKodiAddons (func kodiPackages); + }; + }; }) From 6343120f0475ee3da5c18620188ea245c3b98218 Mon Sep 17 00:00:00 2001 From: Daniel Wagenknecht Date: Sat, 7 Jan 2023 17:35:52 +0100 Subject: [PATCH 3/4] kodi-packages: use kodi release name from kodi package --- pkgs/top-level/kodi-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/kodi-packages.nix b/pkgs/top-level/kodi-packages.nix index 74fb0bffc497..c9c8fe3b6a67 100644 --- a/pkgs/top-level/kodi-packages.nix +++ b/pkgs/top-level/kodi-packages.nix @@ -26,7 +26,7 @@ let self = { addonDir = "/share/kodi/addons"; - rel = "Omega"; + rel = kodi.kodiReleaseName; inherit callPackage kodi hasKodiAddon requiredKodiAddons; From a55f8bd2d21468e95c078f72d4aafad1a0e815ec Mon Sep 17 00:00:00 2001 From: Sergey Kazenyuk Date: Wed, 17 Apr 2024 18:44:21 +0300 Subject: [PATCH 4/4] kodiPackages: add `kazenyuk` to kodi maintainer team --- maintainers/team-list.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/maintainers/team-list.nix b/maintainers/team-list.nix index 7fcfef5546e2..9389514fcba5 100644 --- a/maintainers/team-list.nix +++ b/maintainers/team-list.nix @@ -518,6 +518,7 @@ with lib.maintainers; { cpages dschrempf edwtjo + kazenyuk minijackson peterhoeg sephalon