diff options
Diffstat (limited to 'pkgs/applications/emulators')
-rw-r--r-- | pkgs/applications/emulators/retroarch/retroarch-joypad-autoconfig.nix | 28 | ||||
-rw-r--r-- | pkgs/applications/emulators/retroarch/wrapper.nix | 18 |
2 files changed, 43 insertions, 3 deletions
diff --git a/pkgs/applications/emulators/retroarch/retroarch-joypad-autoconfig.nix b/pkgs/applications/emulators/retroarch/retroarch-joypad-autoconfig.nix new file mode 100644 index 0000000000000..92ba7f20c8b36 --- /dev/null +++ b/pkgs/applications/emulators/retroarch/retroarch-joypad-autoconfig.nix @@ -0,0 +1,28 @@ +{ lib +, stdenvNoCC +, fetchFromGitHub +}: + +stdenvNoCC.mkDerivation rec { + pname = "retroarch-joypad-autoconfig"; + version = "1.15.0"; + + src = fetchFromGitHub { + owner = "libretro"; + repo = "retroarch-joypad-autoconfig"; + rev = "v${version}"; + hash = "sha256-/F2Y08uDA/pIIeLiLfOQfGVjX2pkuOqPourlx2RbZ28="; + }; + + makeFlags = [ + "PREFIX=$(out)" + ]; + + meta = with lib; { + description = "Joypad autoconfig files"; + homepage = "https://www.libretro.com/"; + license = licenses.mit; + maintainers = with maintainers; teams.libretro.members ++ [ ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/applications/emulators/retroarch/wrapper.nix b/pkgs/applications/emulators/retroarch/wrapper.nix index afef0bef8a487..4698bbe5bbedb 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}"; |