From 2511f48e1ccff1c2f7c17b405a861f729aa2b4bf Mon Sep 17 00:00:00 2001 From: Daniel Wagenknecht Date: Fri, 6 Jan 2023 23:11:59 +0100 Subject: [PATCH] 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); + }; + }; })