summary refs log tree commit diff
path: root/pkgs/applications/video/kodi/wrapper.nix
blob: 86164682138d8d07334465dcc1749ce8b1af9fe1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ lib, makeWrapper, buildEnv, kodi, addons }:

let
  # linux distros are supposed to provide pillow and pycryptodome
  requiredPythonPackages = with kodi.pythonPackages; [ pillow pycryptodome] ++ addons;
in

buildEnv {
  name = "${kodi.name}-env";

  paths = [ kodi ] ++ addons;
  pathsToLink = [ "/share" ];

  buildInputs = [ makeWrapper ];

  postBuild = ''
    mkdir $out/bin
    for exe in kodi{,-standalone}
    do
      makeWrapper ${kodi}/bin/$exe $out/bin/$exe \
        --prefix PYTHONPATH : ${kodi.pythonPackages.makePythonPath requiredPythonPackages} \
        --prefix KODI_HOME : $out/share/kodi \
        --prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
          (lib.concatMap
            (plugin: plugin.extraRuntimeDependencies or []) addons)}"
    done
  '';
}