diff options
Diffstat (limited to 'pkgs/misc/emulators/retroarch')
-rw-r--r-- | pkgs/misc/emulators/retroarch/default.nix | 109 | ||||
-rw-r--r-- | pkgs/misc/emulators/retroarch/fix-config.patch | 26 |
2 files changed, 106 insertions, 29 deletions
diff --git a/pkgs/misc/emulators/retroarch/default.nix b/pkgs/misc/emulators/retroarch/default.nix index e4c09c3c8f6c0..21cbcb801616a 100644 --- a/pkgs/misc/emulators/retroarch/default.nix +++ b/pkgs/misc/emulators/retroarch/default.nix @@ -1,53 +1,104 @@ -{ lib, stdenv, fetchFromGitHub, which, pkg-config, makeWrapper -, ffmpeg, libGLU, libGL, freetype, libxml2, python3 -, libobjc, AppKit, Foundation -, alsa-lib ? null -, libdrm ? null -, libpulseaudio ? null -, libv4l ? null -, libX11 ? null -, libXdmcp ? null -, libXext ? null -, libXxf86vm ? null -, mesa ? null -, SDL2 ? null -, udev ? null -, enableNvidiaCgToolkit ? false, nvidia_cg_toolkit ? null -, withVulkan ? stdenv.isLinux, vulkan-loader ? null -, wayland +{ lib +, stdenv +, enableNvidiaCgToolkit ? false +, withVulkan ? stdenv.isLinux +, alsa-lib +, AppKit +, fetchFromGitHub +, ffmpeg +, Foundation +, freetype +, libdrm +, libGL +, libGLU +, libobjc +, libpulseaudio +, libv4l +, libX11 +, libXdmcp +, libXext , libxkbcommon +, libxml2 +, libXxf86vm +, makeWrapper +, mesa +, nvidia_cg_toolkit +, pkg-config +, python3 +, SDL2 +, substituteAll +, udev +, vulkan-loader +, wayland +, which }: with lib; +let + libretroSuperSrc = fetchFromGitHub { + owner = "libretro"; + repo = "libretro-super"; + sha256 = "sha256-4WB6/1DDec+smhMJKLCxWb4+LQlZN8v2ik69saKixkE="; + rev = "fa70d9843838df719623094965bd447e4db0d1b4"; + }; +in stdenv.mkDerivation rec { pname = "retroarch-bare"; - # FIXME: retroarch >=1.9.3 doesn't load the cores - version = "1.9.2"; + version = "1.9.13.2"; src = fetchFromGitHub { owner = "libretro"; repo = "RetroArch"; - sha256 = "sha256-Dwv0hl+d99FbVMG4KnkjO1aYfAw0m4x+zvrbyb/wOX8="; + sha256 = "sha256-fehHchn+o9QM2wIK6zYamnbFvQda32Gw0rJk8Orx00U="; rev = "v${version}"; }; - nativeBuildInputs = [ pkg-config wayland ] - ++ optional withVulkan makeWrapper; + patches = [ + # FIXME: The `retroarch.cfg` file is created once in the first run and only + # updated when needed. However, the file may have out-of-date paths + # In case of issues (e.g.: cores are not loading), please delete the + # `$XDG_CONFIG_HOME/retroarch/retroarch.cfg` file + # See: https://github.com/libretro/RetroArch/issues/13251 + ./fix-config.patch + ]; + + postPatch = '' + substituteInPlace retroarch.cfg \ + --replace "@libretro_directory@" "$out/lib" \ + --replace "@libretro_info_path@" "$out/share/libretro/info" \ + ''; + + nativeBuildInputs = [ pkg-config wayland ] ++ + optional withVulkan makeWrapper; - buildInputs = [ ffmpeg freetype libxml2 libGLU libGL python3 SDL2 which ] - ++ optional enableNvidiaCgToolkit nvidia_cg_toolkit - ++ optional withVulkan vulkan-loader - ++ optionals stdenv.isDarwin [ libobjc AppKit Foundation ] - ++ optionals stdenv.isLinux [ alsa-lib libdrm libpulseaudio libv4l libX11 - libXdmcp libXext libXxf86vm mesa udev - wayland libxkbcommon ]; + buildInputs = [ ffmpeg freetype libxml2 libGLU libGL python3 SDL2 which ] ++ + optional enableNvidiaCgToolkit nvidia_cg_toolkit ++ + optional withVulkan vulkan-loader ++ + optionals stdenv.isDarwin [ libobjc AppKit Foundation ] ++ + optionals stdenv.isLinux [ + alsa-lib + libdrm + libpulseaudio + libv4l + libX11 + libXdmcp + libXext + libXxf86vm + mesa + udev + wayland + libxkbcommon + ]; enableParallelBuilding = true; configureFlags = lib.optionals stdenv.isLinux [ "--enable-kms" "--enable-egl" ]; postInstall = optionalString withVulkan '' + mkdir -p $out/share/libretro/info + # TODO: ideally each core should have its own core information + cp -r ${libretroSuperSrc}/dist/info/* $out/share/libretro/info wrapProgram $out/bin/retroarch --prefix LD_LIBRARY_PATH ':' ${vulkan-loader}/lib ''; diff --git a/pkgs/misc/emulators/retroarch/fix-config.patch b/pkgs/misc/emulators/retroarch/fix-config.patch new file mode 100644 index 0000000000000..1a71bf43cb11f --- /dev/null +++ b/pkgs/misc/emulators/retroarch/fix-config.patch @@ -0,0 +1,26 @@ +diff --git a/retroarch.cfg b/retroarch.cfg +index cdcb199c9f..08b9b1cf10 100644 +--- a/retroarch.cfg ++++ b/retroarch.cfg +@@ -681,7 +681,7 @@ + # menu_show_online_updater = true + + # If disabled, will hide the ability to update cores (and core info files) inside the menu. +-# menu_show_core_updater = true ++menu_show_core_updater = false + + # If disabled, the libretro core will keep running in the background when we + # are in the menu. +@@ -823,10 +823,10 @@ + # rgui_browser_directory = + + # Core directory for libretro core implementations. +-# libretro_directory = ++libretro_directory = @libretro_directory@ + + # Core info directory for libretro core information. +-# libretro_info_path = ++libretro_info_path = @libretro_info_path@ + + # Path to content database directory. + # content_database_path = |