nixpkgs/pkgs/applications/emulators/retroarch/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

136 lines
2.8 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, nixosTests
, enableNvidiaCgToolkit ? false
2022-01-21 21:26:24 +00:00
, withGamemode ? stdenv.isLinux
, withVulkan ? stdenv.isLinux
2022-10-18 16:54:52 +00:00
, withWayland ? stdenv.isLinux
, alsa-lib
2022-08-06 11:04:55 +00:00
, dbus
, fetchFromGitHub
2022-02-05 21:28:01 +00:00
, ffmpeg_4
2022-10-28 11:45:00 +00:00
, flac
, freetype
2022-01-21 21:26:24 +00:00
, gamemode
, libdrm
, libGL
, libGLU
, libpulseaudio
, libretro-core-info
, libv4l
, libX11
, libXdmcp
, libXext
, libxkbcommon
, libxml2
, libXxf86vm
, makeWrapper
2022-10-28 11:45:00 +00:00
, mbedtls
, mesa
, nvidia_cg_toolkit
, pkg-config
, python3
, SDL2
, substituteAll
, udev
, vulkan-loader
, wayland
2022-10-28 11:45:00 +00:00
, zlib
}:
let
2022-10-18 16:54:52 +00:00
runtimeLibs =
lib.optional withVulkan vulkan-loader ++
lib.optional withGamemode (lib.getLib gamemode);
in
stdenv.mkDerivation rec {
pname = "retroarch-bare";
2022-11-21 18:08:26 +00:00
version = "1.13.0";
2013-06-26 11:25:09 +00:00
src = fetchFromGitHub {
owner = "libretro";
repo = "RetroArch";
2022-11-21 18:08:26 +00:00
hash = "sha256-eEe0mM9gUWgEzoRH1Iuet20US9eXNtCVSBi2kX1njVw=";
rev = "v${version}";
2013-06-26 11:25:09 +00:00
};
patches = [
(substituteAll {
src = ./use-fixed-path-for-libretro_core_info.patch;
libretro_info_path = libretro-core-info;
})
];
nativeBuildInputs = [ pkg-config ] ++
2022-10-18 16:54:52 +00:00
lib.optional withWayland wayland ++
2022-01-21 21:26:24 +00:00
lib.optional (runtimeLibs != [ ]) makeWrapper;
2013-06-26 11:25:09 +00:00
2022-10-18 16:54:52 +00:00
buildInputs = [
ffmpeg_4
2022-10-28 11:45:00 +00:00
flac
2022-10-18 16:54:52 +00:00
freetype
libGL
libGLU
libxml2
2022-10-28 11:45:00 +00:00
mbedtls
2022-10-18 16:54:52 +00:00
python3
SDL2
2022-10-28 11:45:00 +00:00
zlib
2022-10-18 16:54:52 +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
];
2018-03-03 02:09:35 +00:00
enableParallelBuilding = true;
2022-10-18 16:54:52 +00:00
configureFlags = [
"--disable-update_cores"
2022-10-28 11:45:00 +00:00
"--disable-builtinmbedtls"
"--disable-builtinzlib"
"--disable-builtinflac"
2022-10-18 16:54:52 +00:00
] ++
lib.optionals stdenv.isLinux [
"--enable-dbus"
"--enable-egl"
"--enable-kms"
];
2019-11-12 09:31:53 +00:00
postInstall = lib.optionalString (runtimeLibs != [ ]) ''
2022-01-21 21:26:24 +00:00
wrapProgram $out/bin/retroarch \
--prefix LD_LIBRARY_PATH ':' ${lib.makeLibraryPath runtimeLibs}
'';
2018-03-03 02:09:35 +00:00
preFixup = "rm $out/bin/retroarch-cg2glsl";
passthru.tests = nixosTests.retroarch;
2022-01-21 21:26:24 +00:00
meta = with lib; {
homepage = "https://libretro.com";
description = "Multi-platform emulator frontend for libretro cores";
2021-11-17 15:09:43 +00:00
license = licenses.gpl3Plus;
2021-11-28 17:50:21 +00:00
platforms = platforms.unix;
2022-01-22 14:01:48 +00:00
changelog = "https://github.com/libretro/RetroArch/blob/v${version}/CHANGES.md";
maintainers = with maintainers; teams.libretro.members ++ [ matthewbauer kolbycrouch ];
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
broken = stdenv.isDarwin;
2013-06-26 11:25:09 +00:00
};
}