nixpkgs/pkgs/applications/emulators/retroarch
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
..
patches
cores.nix treewide: replace stdenv.is with stdenv.hostPlatform.is 2024-09-25 00:04:37 +03:00
default.nix treewide: replace stdenv.is with stdenv.hostPlatform.is 2024-09-25 00:04:37 +03:00
hashes.json libretro.play: unstable-2024-09-04 -> unstable-2024-09-12 (#342542) 2024-09-18 10:48:47 +01:00
kodi-advanced-launchers.nix
libretro-core-info.nix libretro-core-info: 1.18.0 -> 1.19.0 2024-05-31 19:23:19 +00:00
mkLibretroCore.nix
README.md retroarch: add README.md 2024-08-28 13:23:26 +01:00
retroarch-assets.nix retroarch-assets: 1.19.0-unstable-2024-05-30 -> 1.19.0-unstable-2024-08-08 2024-08-11 05:08:55 +00:00
retroarch-joypad-autoconfig.nix retroarch-joypad-autoconfig: 1.18.1 -> 1.19.0 2024-06-03 19:24:18 +00:00
update_cores.py libretro.mame: unstable-2024-05-03 -> unstable-2024-05-04 2024-05-04 13:15:08 +01:00
wrapper.nix

RetroArch

This directory includes RetroArch, libretro cores and related packages.

Adding new cores

The basic steps to add a new core are:

  1. Add the core repository to update_cores.py inside the CORES map.
    • The minimum required parameter is repo
    • If the repository owner is not libretro, set owner parameter
    • If the core needs submodules, set fetch_submodules parameter to True
    • To pin the core to a specific release, set rev parameter
  2. Run ./pkgs/applications/emulators/retroarch/update_cores.py <emulator> to generate hashes.json file
  3. Add your new core to cores.nix file, using mkLibretroCore function
    • In general, the attribute name should be the same as the repo name, unless there is a good reason not to
    • Check the core repo and Libretro documentation for the core you're trying to add for instructions on how to build
    • Also check the examples inside cores.nix
    • If your core is recently released, there is a good chance that you may need to update libretro-core-info for things to work inside RetroArch
  4. Try to build your core with nix-build -A libretro.<core>

Updating cores

Just run:

# From the root of your nixpkgs directory
./pkgs/applications/emulators/retroarch/update_cores.nix

Keep in mind that because of the huge amount of cores that we package here, it is recommended to set GITHUB_TOKEN to your GitHub's Personal Access Token (PAT), otherwise the update will probably fail due to GitHub's API rate limit.

Using RetroArch with cores

To create a custom RetroArch derivation with the cores you want (instead of using retroarchFull that includes all cores), you can use .override like this:

{ pkgs, ... }:

let
  retroarchWithCores = (pkgs.retroarch.override {
    cores = with pkgs.libretro; [
      bsnes
      mgba
      quicknes
    ];
  });
in
{
  environment.systemPackages = [
    retroarchWithCores
  ];
}