Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retroarch: refactor #358405

Merged
merged 17 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/tests/retroarch.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ./make-test-python.nix (
services.xserver.enable = true;
services.xserver.desktopManager.retroarch = {
enable = true;
package = pkgs.retroarchBare;
package = pkgs.retroarch-bare;
};
services.xserver.displayManager = {
sddm.enable = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ packages.
The basic steps to add a new core are:

1. Add a new core using `mkLibretroCore` function (use one of the existing
files as an example)
cores as an example)
2. Add your new core to [`default.nix`](./default.nix) file
3. Try to build your core with `nix-build -A libretro.<core>`

## 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
using `retroarch-full` that includes all cores), you can use `.withCores` like
this:

```nix
{ pkgs, ... }:

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

For advanced customization, see `wrapRetroArch` wrapper.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
lib,
newScope,
fetchFromGitHub,
}:

lib.makeScope newScope (self: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
lib,
stdenv,
makeWrapper,
retroarchBare,
retroarch-bare,
unstableGitUpdater,
zlib,
# Params
Expand All @@ -28,7 +28,7 @@ let
"lib"
"stdenv"
"makeWrapper"
"retroarchBare"
"retroarch-bare"
"unstableGitUpdater"
"zlib"

Expand Down Expand Up @@ -73,7 +73,7 @@ stdenv.mkDerivation (
runHook preInstall

install -Dt ${coreDir} ${coreFilename}
makeWrapper ${retroarchBare}/bin/retroarch $out/bin/${mainProgram} \
makeWrapper ${retroarch-bare}/bin/retroarch $out/bin/${mainProgram} \
--add-flags "-L ${coreDir}/${coreFilename}"

runHook postInstall
Expand All @@ -90,7 +90,7 @@ stdenv.mkDerivation (
with lib;
{
inherit mainProgram;
inherit (retroarchBare.meta) platforms;
inherit (retroarch-bare.meta) platforms;
homepage = "https://www.libretro.com/";
maintainers = with maintainers; teams.libretro.members;
}
Expand Down
148 changes: 0 additions & 148 deletions pkgs/applications/emulators/retroarch/default.nix

This file was deleted.

58 changes: 0 additions & 58 deletions pkgs/applications/emulators/retroarch/wrapper.nix

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
{ stdenv, pkgs, lib, runtimeShell, cores ? [ ] }:
{
stdenv,
pkgs,
lib,
runtimeShell,
cores ? [ ],
}:

let

script = exec: ''
#!${runtimeShell}
nohup sh -c "pkill -SIGTSTP kodi" &
# https://forum.kodi.tv/showthread.php?tid=185074&pid=1622750#pid1622750
nohup sh -c "sleep 10 && ${exec} '$@' -f;pkill -SIGCONT kodi"
'';
scriptSh = exec: pkgs.writeScript ("kodi-"+exec.name) (script exec.path);
execs = map (core: rec { name = core.core; path = core+"/bin/retroarch-"+name;}) cores;

scriptSh = exec: pkgs.writeScript ("kodi-" + exec.name) (script exec.path);
execs = map (core: rec {
name = core.core;
path = core + "/bin/retroarch-" + name;
}) cores;
in

stdenv.mkDerivation {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{ lib
, stdenvNoCC
, fetchFromGitHub
, gitUpdater
{
lib,
stdenvNoCC,
fetchFromGitHub,
gitUpdater,
}:

stdenvNoCC.mkDerivation rec {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{ lib
, stdenvNoCC
, fetchFromGitHub
, unstableGitUpdater
{
lib,
stdenvNoCC,
fetchFromGitHub,
unstableGitUpdater,
}:

stdenvNoCC.mkDerivation {
Expand Down
Loading