From 9d4e344b460935cbdb569f137431b63be322fa28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Thu, 2 Oct 2014 20:09:18 +0200 Subject: [PATCH] xbmc: enable plugins to be picked up from the store. --- pkgs/applications/video/xbmc/default.nix | 2 +- pkgs/applications/video/xbmc/plugins.nix | 56 ++++++++++++++++++++++++ pkgs/applications/video/xbmc/wrapper.nix | 46 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 24 +++++++++- 4 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 pkgs/applications/video/xbmc/plugins.nix create mode 100644 pkgs/applications/video/xbmc/wrapper.nix diff --git a/pkgs/applications/video/xbmc/default.nix b/pkgs/applications/video/xbmc/default.nix index 6d192c967f78..404659208cfc 100644 --- a/pkgs/applications/video/xbmc/default.nix +++ b/pkgs/applications/video/xbmc/default.nix @@ -99,7 +99,7 @@ stdenv.mkDerivation rec { homepage = http://xbmc.org/; description = "Media center"; license = "GPLv2"; - platforms = stdenv.lib.platforms.linux; + platforms = stdenv.lib.platforms.linux; maintainers = [ stdenv.lib.maintainers.iElectric ]; }; } diff --git a/pkgs/applications/video/xbmc/plugins.nix b/pkgs/applications/video/xbmc/plugins.nix new file mode 100644 index 000000000000..336666f1b92a --- /dev/null +++ b/pkgs/applications/video/xbmc/plugins.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchFromGitHub, xbmc }: + +let + + pluginDir = "/lib/xbmc/plugin"; + + mkXBMCPlugin = { plugin, namespace, version, src, meta, ... }: + stdenv.lib.makeOverridable stdenv.mkDerivation rec { + inherit src meta; + name = "xbmc-plugin-${plugin}-${version}"; + passthru = { + xbmcPlugin = pluginDir; + namespace = namespace; + }; + dontStrip = true; + installPhase = '' + d=$out${pluginDir}/${namespace} + mkdir -p $d + cp -R $src/* $d + ''; + }; + +in +{ + + advanced-launcher = mkXBMCPlugin rec { + + plugin = "advanced-launcher"; + namespace = "plugin.program.advanced.launcher"; + version = "2.5.7"; + + src = fetchFromGitHub { + owner = "Angelscry"; + repo = namespace; + rev = "f6f7980dc66d041e1635bb012d79aa8b3a8790ba"; + sha256 = "0wk41lpd6fw504q5x1h76hc99vw4jg4vq44bh7m21ism85ds0r47"; + }; + + meta = with stdenv.lib; { + homepage = "http://forum.xbmc.org/showthread.php?tid=85724"; + description = "A program launcher for XBMC"; + longDescription = '' + Advanced Launcher allows you to start any Linux, Windows and + OS X external applications (with command line support or not) + directly from the XBMC GUI. Advanced Launcher also give you + the possibility to edit, download (from Internet resources) + and manage all the meta-data (informations and images) related + to these applications. + ''; + platforms = platforms.all; + maintainers = with maintainers; [ edwtjo ]; + }; + + }; + +} \ No newline at end of file diff --git a/pkgs/applications/video/xbmc/wrapper.nix b/pkgs/applications/video/xbmc/wrapper.nix new file mode 100644 index 000000000000..b1017c7098c7 --- /dev/null +++ b/pkgs/applications/video/xbmc/wrapper.nix @@ -0,0 +1,46 @@ +{ stdenv, lib, makeWrapper, xbmc, plugins }: + +let + + p = builtins.parseDrvName xbmc.name; + +in + +stdenv.mkDerivation { + + name = "xbmc-" + p.version; + version = p.version; + + buildInputs = [ makeWrapper ]; + + buildCommand = '' + mkdir -p $out/share/xbmc/addons/packages + ${stdenv.lib.concatMapStrings + (plugin: "ln -s ${plugin.out + + plugin.xbmcPlugin + + "/" + plugin.namespace + } $out/share/xbmc/addons/.;") plugins} + $(for plugin in ${xbmc}/share/xbmc/addons/* + do + $(ln -s $plugin/ $out/share/xbmc/addons/.) + done) + $(for share in ${xbmc}/share/xbmc/* + do + $(ln -s $share $out/share/xbmc/.) + done) + makeWrapper ${xbmc}/bin/xbmc $out/bin/xbmc \ + --prefix XBMC_HOME : $out/share/xbmc; + ''; + + preferLocalBuilds = true; + + meta = with xbmc.meta; { + inherit license homepage; + description = description + + " (with plugins: " + + lib.concatStrings (lib.intersperse ", " (map (x: ""+x.name) plugins)) + + ")"; + + }; + +} \ No newline at end of file diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e066726355e6..a5443df556bd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10549,7 +10549,19 @@ let import ../misc/emulators/retroarch/wrapper.nix { inherit stdenv lib makeWrapper retroarch; cores = retroArchCores; - }; + }; + + wrapXBMC = { xbmc }: + let + cfg = stdenv.lib.attrByPath [ "xbmc" ] {} config; + in + import ../applications/video/xbmc/wrapper.nix { + inherit stdenv lib makeWrapper xbmc; + plugins = with xbmcPlugins; + ([] + ++ lib.optional (cfg.enableAdvancedLauncher or false) advanced-launcher + ); + }; wxhexeditor = callPackage ../applications/editors/wxhexeditor { }; @@ -10576,10 +10588,18 @@ let xbindkeys = callPackage ../tools/X11/xbindkeys { }; - xbmc = callPackage ../applications/video/xbmc { + xbmcPlain = callPackage ../applications/video/xbmc { ffmpeg = ffmpeg_1; }; + xbmcPlugins = recurseIntoAttrs (callPackage ../applications/video/xbmc/plugins.nix { + xbmc = xbmcPlain; + }); + + xbmc = wrapXBMC { + xbmc = xbmcPlain; + }; + xbmc-retroarch-advanced-launchers = callPackage ../misc/emulators/retroarch/xbmc-advanced-launchers.nix { cores = retroArchCores;