From 9d93f9bcda9851586cd75d80a8d9c8e9c07b4a19 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 1/4] XBMC AdvancedLauncher RetroArch launchers. These are wrappers for retroarch wrappers, they are needed since launching a process from XBMC(as a display manager and probably otherwise), using AdvancedLauncher, results in it and it's parent recieving the same gamepad input. These wrappers will produce no sound on XBMC and AdvancedLauncher setups not using a sound daemon, since XBMC gets paused while still holding onto the sound device. --- pkgs/misc/emulators/retroarch/cores.nix | 5 ++- .../retroarch/xbmc-advanced-launchers.nix | 39 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 19 +++++++-- 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 pkgs/misc/emulators/retroarch/xbmc-advanced-launchers.nix 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 4777a974d76..e066726355e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10519,13 +10519,11 @@ let gtk_modules = [ libcanberra ]; }; - wrapRetroArch = { retroarch }: + retroArchCores = let cfg = stdenv.lib.attrByPath [ "retroarch" ] {} config; in - import ../misc/emulators/retroarch/wrapper.nix { - inherit stdenv lib makeWrapper retroarch; - cores = with libretro; + with libretro; ([ ] ++ lib.optional (cfg.enable4do or false) _4do ++ lib.optional (cfg.enableBsnesMercury or false) bsnes-mercury @@ -10543,6 +10541,14 @@ let ++ lib.optional (cfg.enableStella or false) stella ++ lib.optional (cfg.enableVbaNext or false) vba-next ); + + wrapRetroArch = { retroarch }: + let + cfg = stdenv.lib.attrByPath [ "retroarch" ] {} config; + in + import ../misc/emulators/retroarch/wrapper.nix { + inherit stdenv lib makeWrapper retroarch; + cores = retroArchCores; }; wxhexeditor = callPackage ../applications/editors/wxhexeditor { }; @@ -10574,6 +10580,11 @@ let ffmpeg = ffmpeg_1; }; + xbmc-retroarch-advanced-launchers = + callPackage ../misc/emulators/retroarch/xbmc-advanced-launchers.nix { + cores = retroArchCores; + }; + xca = callPackage ../applications/misc/xca { }; xcalib = callPackage ../tools/X11/xcalib { }; 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 2/4] 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 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..336666f1b92 --- /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 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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e066726355e..a5443df556b 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; From 37a83771e63e9254131068daed6daeb7aeb9ea90 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 3/4] xmbcPlugins: svtplay added --- pkgs/applications/video/xbmc/plugins.nix | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pkgs/applications/video/xbmc/plugins.nix b/pkgs/applications/video/xbmc/plugins.nix index 336666f1b92..d34fba9ade7 100644 --- a/pkgs/applications/video/xbmc/plugins.nix +++ b/pkgs/applications/video/xbmc/plugins.nix @@ -53,4 +53,32 @@ in }; + 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 From f61594266482550e277f3d9747aa5854e19329f3 Mon Sep 17 00:00:00 2001 From: Rickard Nilsson Date: Thu, 2 Oct 2014 20:09:18 +0200 Subject: [PATCH 4/4] Syntax fix for xbmc/retroarch in all-packages.nix --- pkgs/top-level/all-packages.nix | 69 +++++++++++++++------------------ 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a5443df556b..973e938d62c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10520,48 +10520,41 @@ let }; retroArchCores = - let - cfg = stdenv.lib.attrByPath [ "retroarch" ] {} config; - in - with libretro; + 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 }: - let - cfg = stdenv.lib.attrByPath [ "retroarch" ] {} config; - in - import ../misc/emulators/retroarch/wrapper.nix { - inherit stdenv lib makeWrapper retroarch; - cores = retroArchCores; - }; + wrapRetroArch = { retroarch }: 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 - ); - }; + 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 + ); + }; wxhexeditor = callPackage ../applications/editors/wxhexeditor { };