nixpkgs-suyu/pkgs/misc/emulators/retroarch/kodi-advanced-launchers.nix
Benjamin Herr 76a63de3dc kodi-retroarch-advanced-launchers: take lib arg
This package was changed to refer to `lib` instead of `stdenv.lib`, but
`lib` was not actually in scope. I don't know what this package is about
or how evaluation got to that point, but this is clearly more correct.
2021-05-18 21:15:08 -07:00

38 lines
1 KiB
Nix

{ stdenv, pkgs, lib, cores, runtimeShell }:
assert cores != [];
let
script = exec: ''
#!${runtimeShell}
nohup sh -c "pkill -SIGTSTP kodi" &
# https://forum.kodi.tv/showthread.php?tid=185074&pid=1622750#pid1622750
nohup sh -c "sleep 10 && ${exec} '$@' -f;pkill -SIGCONT kodi"
'';
scriptSh = exec: pkgs.writeScript ("kodi-"+exec.name) (script exec.path);
execs = map (core: rec { name = core.core; path = core+"/bin/retroarch-"+name;}) cores;
in
stdenv.mkDerivation {
pname = "kodi-retroarch-advanced-launchers";
version = "0.2";
dontBuild = true;
buildCommand = ''
mkdir -p $out/bin
${lib.concatMapStrings (exec: "ln -s ${scriptSh exec} $out/bin/kodi-${exec.name};") execs}
'';
meta = {
description = "Kodi retroarch advanced launchers";
longDescription = ''
These retroarch launchers are intended to be used with
advanced (emulation) launcher for Kodi since device input is
otherwise caught by both Kodi and the retroarch process.
'';
license = lib.licenses.gpl3;
};
}