From ce0621ec4f8b2de17ed8e4c96f8a295336989c50 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 10 Mar 2021 08:16:10 -0500 Subject: [PATCH] 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; };