diff --git a/pkgs/applications/video/xbmc/default.nix b/pkgs/applications/video/xbmc/default.nix index 6d192c967f7..404659208cf 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 00000000000..d34fba9ade7 --- /dev/null +++ b/pkgs/applications/video/xbmc/plugins.nix @@ -0,0 +1,84 @@ +{ 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 ]; + }; + + }; + + svtplay = mkXBMCPlugin rec { + + plugin = "svtplay"; + namespace = "plugin.video.svtplay"; + version = "4.0.6"; + + src = fetchFromGitHub { + owner = "nilzen"; + repo = "xbmc-" + plugin; + rev = "4f27254edbd6dc48350152832833c5b164ca58de"; + sha256 = "11r8vljpx9fxwdx20cvkb5szlaypfrn6c235jwcg61s4hmjy4kl8"; + }; + + meta = with stdenv.lib; { + homepage = "http://forum.xbmc.org/showthread.php?tid=67110"; + description = "Watch content from SVT Play"; + longDescription = '' + With this addon you can stream content from SVT Play + (svtplay.se). The plugin fetches the video URL from the SVT + Play website and feeds it to the XBMC video player. HLS (m3u8) + is the preferred video format by the plugin. + ''; + 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 00000000000..b1017c7098c --- /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/misc/emulators/retroarch/cores.nix b/pkgs/misc/emulators/retroarch/cores.nix index a8b74959d90..db412eb883d 100644 --- a/pkgs/misc/emulators/retroarch/cores.nix +++ b/pkgs/misc/emulators/retroarch/cores.nix @@ -24,7 +24,10 @@ let --add-flags "-L $COREDIR/${d2u core}_libretro.so $@" ''; - passthru.libretroCore = "/lib/retroarch/cores"; + passthru = { + core = core; + libretroCore = "/lib/retroarch/cores"; + }; meta = with stdenv.lib; { inherit description; diff --git a/pkgs/misc/emulators/retroarch/xbmc-advanced-launchers.nix b/pkgs/misc/emulators/retroarch/xbmc-advanced-launchers.nix new file mode 100644 index 00000000000..ec539cb43f9 --- /dev/null +++ b/pkgs/misc/emulators/retroarch/xbmc-advanced-launchers.nix @@ -0,0 +1,39 @@ +{ stdenv, pkgs, cores }: + +assert cores != []; + +with pkgs.lib; + +let + + script = exec: '' + #!${stdenv.shell} + nohup sh -c "sleep 1 && pkill -SIGSTOP xbmc" & + nohup sh -c "${exec} '$@' -f;pkill -SIGCONT xbmc" + ''; + scriptSh = exec: pkgs.writeScript ("xbmc-"+exec.name) (script exec.path); + execs = map (core: rec { name = core.core; path = core+"/bin/retroarch-"+name;}) cores; + +in + +stdenv.mkDerivation rec { + name = "xbmc-retroarch-advanced-launchers-${version}"; + version = "0.2"; + + dontBuild = true; + + buildCommand = '' + mkdir -p $out/bin + ${stdenv.lib.concatMapStrings (exec: "ln -s ${scriptSh exec} $out/bin/xbmc-${exec.name};") execs} + ''; + + meta = { + description = "XBMC retroarch advanced launchers"; + longDescription = '' + These retroarch launchers are intended to be used with + anglescry advanced launcher for XBMC since device input is + caught by both XBMC and the retroarch process. + ''; + license = "GPL-3"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 183f11b711c..3262110cf0f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10559,29 +10559,40 @@ let gtk_modules = [ libcanberra ]; }; - wrapRetroArch = { retroarch }: - let - cfg = stdenv.lib.attrByPath [ "retroarch" ] {} config; - in - import ../misc/emulators/retroarch/wrapper.nix { - inherit stdenv lib makeWrapper retroarch; - cores = with libretro; + retroArchCores = + let + cfg = config.retroarch or {}; + inherit (lib) optional; + in with libretro; ([ ] - ++ lib.optional (cfg.enable4do or false) _4do - ++ lib.optional (cfg.enableBsnesMercury or false) bsnes-mercury - ++ lib.optional (cfg.enableDesmume or false) desmume - ++ lib.optional (cfg.enableFBA or false) fba - ++ lib.optional (cfg.enableFceumm or false) fceumm - ++ lib.optional (cfg.enableGambatte or false) gambatte - ++ lib.optional (cfg.enableGenesisPlusGX or false) genesis-plus-gx - ++ lib.optional (cfg.enableMupen64Plus or false) mupen64plus - ++ lib.optional (cfg.enablePicodrive or false) picodrive - ++ lib.optional (cfg.enablePrboom or false) prboom - ++ lib.optional (cfg.enablePPSSPP or false) ppsspp - ++ lib.optional (cfg.enableScummVM or false) scummvm - ++ lib.optional (cfg.enableSnes9xNext or false) snes9x-next - ++ lib.optional (cfg.enableStella or false) stella - ++ lib.optional (cfg.enableVbaNext or false) vba-next + ++ optional (cfg.enable4do or false) _4do + ++ optional (cfg.enableBsnesMercury or false) bsnes-mercury + ++ optional (cfg.enableDesmume or false) desmume + ++ optional (cfg.enableFBA or false) fba + ++ optional (cfg.enableFceumm or false) fceumm + ++ optional (cfg.enableGambatte or false) gambatte + ++ optional (cfg.enableGenesisPlusGX or false) genesis-plus-gx + ++ optional (cfg.enableMupen64Plus or false) mupen64plus + ++ optional (cfg.enablePicodrive or false) picodrive + ++ optional (cfg.enablePrboom or false) prboom + ++ optional (cfg.enablePPSSPP or false) ppsspp + ++ optional (cfg.enableScummVM or false) scummvm + ++ optional (cfg.enableSnes9xNext or false) snes9x-next + ++ optional (cfg.enableStella or false) stella + ++ optional (cfg.enableVbaNext or false) vba-next + ); + + wrapRetroArch = { retroarch }: import ../misc/emulators/retroarch/wrapper.nix { + inherit stdenv lib makeWrapper retroarch; + cores = retroArchCores; + }; + + wrapXBMC = { xbmc }: import ../applications/video/xbmc/wrapper.nix { + inherit stdenv lib makeWrapper xbmc; + plugins = let inherit (lib) optional; in with xbmcPlugins; + ([] + ++ optional (config.xbmc.enableAdvancedLauncher or false) advanced-launcher + ++ optional (config.xbmc.enableSVTPlay or false) svtplay ); }; @@ -10610,10 +10621,23 @@ 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; + }; + xca = callPackage ../applications/misc/xca { }; xcalib = callPackage ../tools/X11/xcalib { };