anchor.diff:  , ffmpeg
   , Foundation
   , freetype
  +, gamemode
   , libdrm
   , libGL
   , libGLU
  
positive.code:   '';
  
    nativeBuildInputs = [ pkg-config ] ++
      optional stdenv.isLinux 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 ''
      mkdir -p $out/share/libretro/info
      # TODO: ideally each core should have its own core information
      cp -r ${libretroSuperSrc}/* $out/share/libretro/info
      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;
  
negative.code: , pkg-config
  , python3
  , SDL2
  , udev
  , vulkan-loader
  , wayland
  , which
  }:
  
  let
    version = "1.10.0";
    libretroCoreInfo = fetchFromGitHub {
      owner = "libretro";
      repo = "libretro-core-info";
      sha256 = "sha256-3j7fvcfbgyk71MmbUUKYi+/0cpQFNbYXO+DMDUjDqkQ=";
      rev = "v${version}";
    };
    runtimeLibs = lib.optional withVulkan vulkan-loader
      ++ lib.optional withGamemode gamemode.lib;
  in
  stdenv.mkDerivation rec {
    pname = "retroarch-bare";
  