about summary refs log tree commit diff
path: root/pkgs/applications/emulators/retroarch/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/emulators/retroarch/wrapper.nix')
-rw-r--r--pkgs/applications/emulators/retroarch/wrapper.nix18
1 files changed, 15 insertions, 3 deletions
diff --git a/pkgs/applications/emulators/retroarch/wrapper.nix b/pkgs/applications/emulators/retroarch/wrapper.nix
index afef0bef8a48..4698bbe5bbed 100644
--- a/pkgs/applications/emulators/retroarch/wrapper.nix
+++ b/pkgs/applications/emulators/retroarch/wrapper.nix
@@ -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}";