forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / applications / emulators / retroarch / kodi-advanced-launchers.nix
blob9d83c46396c37c7cb4f44c868606c8af1db01b85
1 { stdenv, pkgs, lib, runtimeShell, cores ? [ ] }:
3 let
5   script = exec: ''
6     #!${runtimeShell}
7     nohup sh -c "pkill -SIGTSTP kodi" &
8     # https://forum.kodi.tv/showthread.php?tid=185074&pid=1622750#pid1622750
9     nohup sh -c "sleep 10 && ${exec} '$@' -f;pkill -SIGCONT kodi"
10   '';
11   scriptSh = exec: pkgs.writeScript ("kodi-"+exec.name) (script exec.path);
12   execs = map (core: rec { name = core.core; path = core+"/bin/retroarch-"+name;}) cores;
16 stdenv.mkDerivation {
17   pname = "kodi-retroarch-advanced-launchers";
18   version = "0.2";
20   dontBuild = true;
22   buildCommand = ''
23     mkdir -p $out/bin
24     ${lib.concatMapStrings (exec: "ln -s ${scriptSh exec} $out/bin/kodi-${exec.name};") execs}
25   '';
27   meta = {
28     description = "Kodi retroarch advanced launchers";
29     longDescription = ''
30       These retroarch launchers are intended to be used with
31       advanced (emulation) launcher for Kodi since device input is
32       otherwise caught by both Kodi and the retroarch process.
33     '';
34     license = lib.licenses.gpl3;
35   };