2022-10-28 13:26:53 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, makeWrapper
|
|
|
|
, retroarch
|
|
|
|
, symlinkJoin
|
2023-07-19 11:11:14 +00:00
|
|
|
, runCommand
|
2022-10-28 13:26:53 +00:00
|
|
|
, cores ? [ ]
|
2023-07-19 11:11:14 +00:00
|
|
|
, settings ? { }
|
2022-10-28 13:26:53 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2023-07-19 11:11:14 +00:00
|
|
|
settingsPath = runCommand "declarative-retroarch.cfg"
|
|
|
|
{
|
|
|
|
value = lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${n} = \"${v}\"") settings);
|
|
|
|
passAsFile = [ "value" ];
|
|
|
|
}
|
|
|
|
''
|
|
|
|
cp "$valuePath" "$out"
|
|
|
|
'';
|
|
|
|
|
2022-10-28 22:52:09 +00:00
|
|
|
# All cores should be located in the same path after symlinkJoin,
|
|
|
|
# but let's be safe here
|
2022-10-28 13:26:53 +00:00
|
|
|
coresPath = lib.lists.unique (map (c: c.libretroCore) cores);
|
2023-07-19 11:11:14 +00:00
|
|
|
wrapperArgs = lib.strings.escapeShellArgs (
|
|
|
|
(lib.lists.flatten (map (p: [ "--add-flags" "-L ${placeholder "out" + p}" ]) coresPath))
|
|
|
|
++ [ "--add-flags" "--appendconfig=${settingsPath}" ]
|
|
|
|
);
|
2022-10-28 13:26:53 +00:00
|
|
|
in
|
|
|
|
symlinkJoin {
|
|
|
|
name = "retroarch-with-cores-${lib.getVersion retroarch}";
|
|
|
|
|
|
|
|
paths = [ retroarch ] ++ cores;
|
libretro-cores:
- adding: 4do, desmume, fceumm, mame, mupen64plus, scummvm,
snes9x, stella, picodrive, ppsspp and vba
retroarch:
- added retroarch wrapper for configured cores
- changed attributes, old retroarch is now retroarchBare*
2014-08-26 17:32:35 +00:00
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
libretro-cores:
- adding: 4do, desmume, fceumm, mame, mupen64plus, scummvm,
snes9x, stella, picodrive, ppsspp and vba
retroarch:
- added retroarch wrapper for configured cores
- changed attributes, old retroarch is now retroarchBare*
2014-08-26 17:32:35 +00:00
|
|
|
|
2022-10-28 13:26:53 +00:00
|
|
|
passthru = {
|
|
|
|
inherit cores;
|
|
|
|
unwrapped = retroarch;
|
|
|
|
};
|
2018-05-11 01:07:11 +00:00
|
|
|
|
2022-10-28 13:26:53 +00:00
|
|
|
postBuild = ''
|
|
|
|
# remove core specific binaries
|
2022-10-28 22:52:09 +00:00
|
|
|
find $out/bin -name 'retroarch-*' -type l -delete
|
|
|
|
|
|
|
|
# wrap binary to load cores from the proper location(s)
|
|
|
|
wrapProgram $out/bin/retroarch ${wrapperArgs}
|
libretro-cores:
- adding: 4do, desmume, fceumm, mame, mupen64plus, scummvm,
snes9x, stella, picodrive, ppsspp and vba
retroarch:
- added retroarch wrapper for configured cores
- changed attributes, old retroarch is now retroarchBare*
2014-08-26 17:32:35 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with retroarch.meta; {
|
2022-02-19 16:53:20 +00:00
|
|
|
inherit changelog description homepage license maintainers platforms;
|
2022-03-05 01:00:30 +00:00
|
|
|
longDescription = ''
|
|
|
|
RetroArch is the reference frontend for the libretro API.
|
2022-10-28 13:26:53 +00:00
|
|
|
''
|
|
|
|
+ lib.optionalString (cores != [ ]) ''
|
2022-10-28 22:52:09 +00:00
|
|
|
The following cores are included: ${lib.concatStringsSep ", " (map (c: c.core) cores)}
|
2022-03-05 01:00:30 +00:00
|
|
|
'';
|
2022-10-28 13:26:53 +00:00
|
|
|
mainProgram = "retroarch";
|
libretro-cores:
- adding: 4do, desmume, fceumm, mame, mupen64plus, scummvm,
snes9x, stella, picodrive, ppsspp and vba
retroarch:
- added retroarch wrapper for configured cores
- changed attributes, old retroarch is now retroarchBare*
2014-08-26 17:32:35 +00:00
|
|
|
};
|
|
|
|
}
|