Files
nixpkgs/pkgs/applications/video/kodi/wrapper.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

54 lines
1.4 KiB
Nix

{
lib,
makeWrapper,
buildEnv,
kodi,
addons,
callPackage,
}:
let
kodiPackages = callPackage ../../../top-level/kodi-packages.nix { inherit kodi; };
# linux distros are supposed to provide pillow and pycryptodome
requiredPythonPath =
with kodi.pythonPackages;
makePythonPath [
pillow
pycryptodome
];
# each kodi addon can potentially export a python module which should be included in PYTHONPATH
# see any addon which supplies `passthru.pythonPath` and the corresponding entry in the addons `addon.xml`
# eg. `<extension point="xbmc.python.module" library="lib" />` -> pythonPath = "lib";
additionalPythonPath =
let
addonsWithPythonPath = lib.filter (addon: addon ? pythonPath) addons;
in
lib.concatMapStringsSep ":" (
addon: "${addon}${kodiPackages.addonDir}/${addon.namespace}/${addon.pythonPath}"
) addonsWithPythonPath;
in
buildEnv {
name = "${kodi.name}-env";
paths = [ kodi ] ++ addons;
pathsToLink = [ "/share" ];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
mkdir $out/bin
for exe in kodi{,-standalone}
do
makeWrapper ${kodi}/bin/$exe $out/bin/$exe \
--prefix PYTHONPATH : ${requiredPythonPath}:${additionalPythonPath} \
--prefix KODI_HOME : $out/share/kodi \
--prefix LD_LIBRARY_PATH ":" "${
lib.makeLibraryPath (lib.concatMap (plugin: plugin.extraRuntimeDependencies or [ ]) addons)
}"
done
'';
}