mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 03:56:17 +03:00
retroarch: add support for declarative settings
Add a new optional 'settings' attrset to the wrapper derivation, which gets serialized to a file and passed to RetroArch as --appendconfig= at runtime. This allows overriding settings from ~/.config/retroarch/retroarch.cfg (which initially gets created as a dump of all internal retroarch settings -- stateful and messy).
This commit is contained in:
parent
7120535c32
commit
801cc44765
@ -3,16 +3,28 @@
|
||||
, makeWrapper
|
||||
, retroarch
|
||||
, symlinkJoin
|
||||
, runCommand
|
||||
, cores ? [ ]
|
||||
, settings ? { }
|
||||
}:
|
||||
|
||||
let
|
||||
settingsPath = runCommand "declarative-retroarch.cfg"
|
||||
{
|
||||
value = lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${n} = \"${v}\"") settings);
|
||||
passAsFile = [ "value" ];
|
||||
}
|
||||
''
|
||||
cp "$valuePath" "$out"
|
||||
'';
|
||||
|
||||
# All cores should be located in the same path after symlinkJoin,
|
||||
# but let's be safe here
|
||||
coresPath = lib.lists.unique (map (c: c.libretroCore) cores);
|
||||
wrapperArgs = lib.strings.escapeShellArgs
|
||||
(lib.lists.flatten
|
||||
(map (p: [ "--add-flags" "-L ${placeholder "out" + p}" ]) coresPath));
|
||||
wrapperArgs = lib.strings.escapeShellArgs (
|
||||
(lib.lists.flatten (map (p: [ "--add-flags" "-L ${placeholder "out" + p}" ]) coresPath))
|
||||
++ [ "--add-flags" "--appendconfig=${settingsPath}" ]
|
||||
);
|
||||
in
|
||||
symlinkJoin {
|
||||
name = "retroarch-with-cores-${lib.getVersion retroarch}";
|
||||
|
@ -2642,9 +2642,9 @@ with pkgs;
|
||||
(builtins.attrValues libretro);
|
||||
};
|
||||
|
||||
wrapRetroArch = { retroarch }:
|
||||
wrapRetroArch = { retroarch, settings ? {} }:
|
||||
callPackage ../applications/emulators/retroarch/wrapper.nix
|
||||
{ inherit retroarch; };
|
||||
{ inherit retroarch settings; };
|
||||
|
||||
retroarch = wrapRetroArch {
|
||||
retroarch = retroarchBare.override {
|
||||
|
Loading…
Reference in New Issue
Block a user