nixpkgs/pkgs/misc/emulators/retroarch/default.nix
2021-11-17 12:09:57 -03:00

63 lines
1.9 KiB
Nix

{ 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
, libxkbcommon
}:
with lib;
stdenv.mkDerivation rec {
pname = "retroarch-bare";
# FIXME: retroarch >=1.9.3 doesn't load the cores
version = "1.9.2";
src = fetchFromGitHub {
owner = "libretro";
repo = "RetroArch";
sha256 = "sha256-Dwv0hl+d99FbVMG4KnkjO1aYfAw0m4x+zvrbyb/wOX8=";
rev = "v${version}";
};
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 ];
enableParallelBuilding = true;
configureFlags = lib.optionals stdenv.isLinux [ "--enable-kms" "--enable-egl" ];
postInstall = optionalString withVulkan ''
wrapProgram $out/bin/retroarch --prefix LD_LIBRARY_PATH ':' ${vulkan-loader}/lib
'';
preFixup = "rm $out/bin/retroarch-cg2glsl";
meta = {
homepage = "https://libretro.com";
description = "Multi-platform emulator frontend for libretro cores";
license = licenses.gpl3Plus;
platforms = platforms.all;
maintainers = with maintainers; [ MP2E edwtjo matthewbauer kolbycrouch thiagokokada ];
};
}