kodi: wrapper: simplify

This commit is contained in:
Jan Malakhovski 2018-09-06 19:40:16 +00:00
parent 574f2a33c0
commit 88d69df250

View File

@ -1,54 +1,24 @@
{ stdenv, lib, makeWrapper, kodi, plugins }:
{ stdenv, lib, makeWrapper, buildEnv, kodi, plugins }:
let
buildEnv {
name = "kodi-with-plugins-${(builtins.parseDrvName kodi.name).version}";
p = builtins.parseDrvName kodi.name;
in
stdenv.mkDerivation {
name = "kodi-" + p.version;
version = p.version;
paths = [ kodi ] ++ plugins;
pathsToLink = [ "/share" ];
buildInputs = [ makeWrapper ];
buildCommand = ''
mkdir -p $out/share/kodi/addons
${stdenv.lib.concatMapStrings
(plugin: "ln -s ${plugin.out
+ plugin.kodiPlugin
+ "/" + plugin.namespace
} $out/share/kodi/addons/.;") plugins}
$(for plugin in ${kodi}/share/kodi/addons/*
postBuild = ''
mkdir $out/bin
for exe in kodi{,-standalone}
do
$(ln -s $plugin/ $out/share/kodi/addons/.)
done)
$(for share in ${kodi}/share/kodi/*
do
$(ln -s $share $out/share/kodi/.)
done)
$(for passthrough in icons xsessions applications
do
ln -s ${kodi}/share/$passthrough $out/share/
done)
$(for exe in kodi{,-standalone}
do
makeWrapper ${kodi}/bin/$exe $out/bin/$exe \
--prefix KODI_HOME : $out/share/kodi;
done)
makeWrapper ${kodi}/bin/$exe $out/bin/$exe \
--prefix KODI_HOME : $out/share/kodi
done
'';
preferLocalBuild = true;
meta = with kodi.meta; {
inherit license homepage;
description = description
+ " (with plugins: "
+ lib.concatStrings (lib.intersperse ", " (map (x: ""+x.name) plugins))
+ ")";
platforms = stdenv.lib.platforms.linux;
meta = kodi.meta // {
description = kodi.meta.description
+ " (with plugins: ${lib.concatMapStringsSep ", " (x: x.name) plugins})";
};
}