2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-10-06 18:32:54 +00:00
|
|
|
, nixosTests
|
2021-12-06 16:07:01 +00:00
|
|
|
, enableNvidiaCgToolkit ? false
|
2022-01-25 03:21:06 +00:00
|
|
|
, withGamemode ? stdenv.isLinux
|
2021-12-06 16:07:01 +00:00
|
|
|
, withVulkan ? stdenv.isLinux
|
2022-10-21 18:38:19 +00:00
|
|
|
, withWayland ? stdenv.isLinux
|
2021-12-06 16:07:01 +00:00
|
|
|
, alsa-lib
|
2022-08-12 12:06:08 +00:00
|
|
|
, dbus
|
2021-12-06 16:07:01 +00:00
|
|
|
, fetchFromGitHub
|
2022-02-10 20:34:41 +00:00
|
|
|
, ffmpeg_4
|
2022-10-30 15:09:59 +00:00
|
|
|
, flac
|
2021-12-06 16:07:01 +00:00
|
|
|
, freetype
|
2022-01-25 03:21:06 +00:00
|
|
|
, gamemode
|
2021-12-06 16:07:01 +00:00
|
|
|
, libdrm
|
|
|
|
, libGL
|
|
|
|
, libGLU
|
|
|
|
, libpulseaudio
|
2022-10-30 15:09:59 +00:00
|
|
|
, libretro-core-info
|
2021-12-06 16:07:01 +00:00
|
|
|
, libv4l
|
|
|
|
, libX11
|
|
|
|
, libXdmcp
|
|
|
|
, libXext
|
2020-04-24 23:36:52 +00:00
|
|
|
, libxkbcommon
|
2021-12-06 16:07:01 +00:00
|
|
|
, libxml2
|
|
|
|
, libXxf86vm
|
|
|
|
, makeWrapper
|
2022-10-30 15:09:59 +00:00
|
|
|
, mbedtls
|
2021-12-06 16:07:01 +00:00
|
|
|
, mesa
|
|
|
|
, nvidia_cg_toolkit
|
|
|
|
, pkg-config
|
|
|
|
, python3
|
|
|
|
, SDL2
|
2022-10-30 15:09:59 +00:00
|
|
|
, substituteAll
|
2021-12-06 16:07:01 +00:00
|
|
|
, udev
|
|
|
|
, vulkan-loader
|
|
|
|
, wayland
|
2022-10-30 15:09:59 +00:00
|
|
|
, zlib
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
let
|
2022-10-21 18:38:19 +00:00
|
|
|
runtimeLibs =
|
|
|
|
lib.optional withVulkan vulkan-loader ++
|
|
|
|
lib.optional withGamemode (lib.getLib gamemode);
|
2021-12-06 16:07:01 +00:00
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "retroarch-bare";
|
2022-11-27 09:42:12 +00:00
|
|
|
version = "1.13.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libretro";
|
|
|
|
repo = "RetroArch";
|
2022-11-27 09:42:12 +00:00
|
|
|
hash = "sha256-eEe0mM9gUWgEzoRH1Iuet20US9eXNtCVSBi2kX1njVw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "v${version}";
|
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
patches = [
|
2022-10-30 15:09:59 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./use-fixed-path-for-libretro_core_info.patch;
|
|
|
|
libretro_info_path = libretro-core-info;
|
|
|
|
})
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ] ++
|
2022-10-21 18:38:19 +00:00
|
|
|
lib.optional withWayland wayland ++
|
2022-01-25 03:21:06 +00:00
|
|
|
lib.optional (runtimeLibs != [ ]) makeWrapper;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
buildInputs = [
|
|
|
|
ffmpeg_4
|
2022-10-30 15:09:59 +00:00
|
|
|
flac
|
2022-10-21 18:38:19 +00:00
|
|
|
freetype
|
|
|
|
libGL
|
|
|
|
libGLU
|
|
|
|
libxml2
|
2022-10-30 15:09:59 +00:00
|
|
|
mbedtls
|
2022-10-21 18:38:19 +00:00
|
|
|
python3
|
|
|
|
SDL2
|
2022-10-30 15:09:59 +00:00
|
|
|
zlib
|
2022-10-21 18:38:19 +00:00
|
|
|
] ++
|
|
|
|
lib.optional enableNvidiaCgToolkit nvidia_cg_toolkit ++
|
|
|
|
lib.optional withVulkan vulkan-loader ++
|
|
|
|
lib.optional withWayland wayland ++
|
|
|
|
lib.optionals stdenv.isLinux [
|
|
|
|
alsa-lib
|
|
|
|
dbus
|
|
|
|
libX11
|
|
|
|
libXdmcp
|
|
|
|
libXext
|
|
|
|
libXxf86vm
|
|
|
|
libdrm
|
|
|
|
libpulseaudio
|
|
|
|
libv4l
|
|
|
|
libxkbcommon
|
|
|
|
mesa
|
|
|
|
udev
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--disable-update_cores"
|
2022-10-30 15:09:59 +00:00
|
|
|
"--disable-builtinmbedtls"
|
|
|
|
"--disable-builtinzlib"
|
|
|
|
"--disable-builtinflac"
|
2022-10-21 18:38:19 +00:00
|
|
|
] ++
|
|
|
|
lib.optionals stdenv.isLinux [
|
|
|
|
"--enable-dbus"
|
|
|
|
"--enable-egl"
|
|
|
|
"--enable-kms"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
postInstall = lib.optionalString (runtimeLibs != [ ]) ''
|
2022-01-25 03:21:06 +00:00
|
|
|
wrapProgram $out/bin/retroarch \
|
|
|
|
--prefix LD_LIBRARY_PATH ':' ${lib.makeLibraryPath runtimeLibs}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = "rm $out/bin/retroarch-cg2glsl";
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
passthru.tests = nixosTests.retroarch;
|
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://libretro.com";
|
|
|
|
description = "Multi-platform emulator frontend for libretro cores";
|
2021-12-06 16:07:01 +00:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
platforms = platforms.unix;
|
2022-01-25 03:21:06 +00:00
|
|
|
changelog = "https://github.com/libretro/RetroArch/blob/v${version}/CHANGES.md";
|
2022-10-06 18:32:54 +00:00
|
|
|
maintainers = with maintainers; teams.libretro.members ++ [ matthewbauer kolbycrouch ];
|
2022-10-30 15:09:59 +00:00
|
|
|
mainProgram = "retroarch";
|
|
|
|
# If you want to (re)-add support for macOS, see:
|
|
|
|
# https://docs.libretro.com/development/retroarch/compilation/osx/
|
|
|
|
# and
|
|
|
|
# https://github.com/libretro/RetroArch/blob/71eb74d256cb4dc5b8b43991aec74980547c5069/.gitlab-ci.yml#L330
|
2022-10-21 18:38:19 +00:00
|
|
|
broken = stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|