fix bin name search
This commit is contained in:
@@ -6,16 +6,16 @@ let
|
|||||||
cfg = config.programs.steam-rom-manager;
|
cfg = config.programs.steam-rom-manager;
|
||||||
|
|
||||||
# Function to find the main binary in a package
|
# Function to find the main binary in a package
|
||||||
findMainBinary = pkg: name:
|
findMainBinary = pkg:
|
||||||
let
|
let
|
||||||
pkgName = pkg.pname or (builtins.parseDrvName pkg.name).name;
|
pkgName = pkg.pname or (builtins.parseDrvName pkg.name).name;
|
||||||
binPath = "${pkg}/bin/${pkgName}";
|
|
||||||
|
|
||||||
commonVariants = [
|
commonVariants = [
|
||||||
pkgName
|
pkgName
|
||||||
"${pkgName}-qt"
|
"${pkgName}-qt"
|
||||||
"${pkgName}-gtk"
|
"${pkgName}-gtk"
|
||||||
"${pkgName}-emu"
|
"${pkgName}-emu"
|
||||||
|
"Ryujinx"
|
||||||
];
|
];
|
||||||
|
|
||||||
existingVariant = findFirst
|
existingVariant = findFirst
|
||||||
@@ -23,9 +23,7 @@ let
|
|||||||
null
|
null
|
||||||
commonVariants;
|
commonVariants;
|
||||||
in
|
in
|
||||||
if name != ""
|
if existingVariant != null
|
||||||
then name
|
|
||||||
else if existingVariant != null
|
|
||||||
then existingVariant
|
then existingVariant
|
||||||
else pkgName;
|
else pkgName;
|
||||||
|
|
||||||
@@ -35,118 +33,96 @@ let
|
|||||||
romFolder = "switch";
|
romFolder = "switch";
|
||||||
fileTypes = [ ".nca" ".NCA" ".nro" ".NRO" ".nso" ".NSO" ".nsp" ".NSP" ".xci" ".XCI" ];
|
fileTypes = [ ".nca" ".NCA" ".nro" ".NRO" ".nso" ".NSO" ".nsp" ".NSP" ".xci" ".XCI" ];
|
||||||
package = pkgs.ryujinx;
|
package = pkgs.ryujinx;
|
||||||
binaryName = "Ryujinx";
|
|
||||||
};
|
};
|
||||||
yuzu = {
|
yuzu = {
|
||||||
romFolder = "switch";
|
romFolder = "switch";
|
||||||
fileTypes = [ ".nsp" ".NSP" ".xci" ".XCI" ];
|
fileTypes = [ ".nsp" ".NSP" ".xci" ".XCI" ];
|
||||||
package = pkgs.yuzu;
|
package = pkgs.yuzu;
|
||||||
binaryName = "yuzu";
|
|
||||||
};
|
};
|
||||||
pcsx2 = {
|
pcsx2 = {
|
||||||
romFolder = "ps2";
|
romFolder = "ps2";
|
||||||
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
|
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
|
||||||
package = pkgs.pcsx2;
|
package = pkgs.pcsx2;
|
||||||
binaryName = "pcsx2";
|
|
||||||
};
|
};
|
||||||
rpcs3 = {
|
rpcs3 = {
|
||||||
romFolder = "ps3";
|
romFolder = "ps3";
|
||||||
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".pkg" ".PKG" ];
|
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".pkg" ".PKG" ];
|
||||||
package = pkgs.rpcs3;
|
package = pkgs.rpcs3;
|
||||||
binaryName = "rpcs3";
|
|
||||||
};
|
};
|
||||||
dolphin-emu = {
|
dolphin-emu = {
|
||||||
romFolder = "gc";
|
romFolder = "gc";
|
||||||
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ".ciso" ".CISO" ];
|
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ".ciso" ".CISO" ];
|
||||||
package = pkgs.dolphin-emu;
|
package = pkgs.dolphin-emu;
|
||||||
binaryName = "dolphin-emu";
|
|
||||||
};
|
};
|
||||||
duckstation = {
|
duckstation = {
|
||||||
romFolder = "psx";
|
romFolder = "psx";
|
||||||
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ".pbp" ".PBP" ];
|
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ".pbp" ".PBP" ];
|
||||||
package = pkgs.duckstation;
|
package = pkgs.duckstation;
|
||||||
binaryName = "duckstation";
|
|
||||||
};
|
};
|
||||||
melonDS = {
|
melonDS = {
|
||||||
romFolder = "nds";
|
romFolder = "nds";
|
||||||
fileTypes = [ ".nds" ".NDS" ];
|
fileTypes = [ ".nds" ".NDS" ];
|
||||||
package = pkgs.melonDS;
|
package = pkgs.melonDS;
|
||||||
binaryName = "melonDS";
|
|
||||||
};
|
};
|
||||||
cemu = {
|
cemu = {
|
||||||
romFolder = "wiiu";
|
romFolder = "wiiu";
|
||||||
fileTypes = [ ".wud" ".WUD" ".wux" ".WUX" ".rpx" ".RPX" ];
|
fileTypes = [ ".wud" ".WUD" ".wux" ".WUX" ".rpx" ".RPX" ];
|
||||||
package = pkgs.cemu;
|
package = pkgs.cemu;
|
||||||
binaryName = "cemu";
|
|
||||||
};
|
};
|
||||||
ppsspp = {
|
ppsspp = {
|
||||||
romFolder = "psp";
|
romFolder = "psp";
|
||||||
fileTypes = [ ".iso" ".ISO" ".cso" ".CSO" ".pbp" ".PBP" ];
|
fileTypes = [ ".iso" ".ISO" ".cso" ".CSO" ".pbp" ".PBP" ];
|
||||||
package = pkgs.ppsspp;
|
package = pkgs.ppsspp;
|
||||||
binaryName = "ppsspp";
|
|
||||||
};
|
};
|
||||||
mame = {
|
mame = {
|
||||||
romFolder = "arcade";
|
romFolder = "arcade";
|
||||||
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ];
|
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ];
|
||||||
package = pkgs.mame;
|
package = pkgs.mame;
|
||||||
binaryName = "mame";
|
|
||||||
};
|
};
|
||||||
dosbox = {
|
dosbox = {
|
||||||
romFolder = "dos";
|
romFolder = "dos";
|
||||||
fileTypes = [ ".exe" ".EXE" ".bat" ".BAT" ".com" ".COM" ];
|
fileTypes = [ ".exe" ".EXE" ".bat" ".BAT" ".com" ".COM" ];
|
||||||
package = pkgs.dosbox;
|
package = pkgs.dosbox;
|
||||||
binaryName = "dosbox";
|
|
||||||
};
|
};
|
||||||
snes9x = {
|
snes9x = {
|
||||||
romFolder = "snes";
|
romFolder = "snes";
|
||||||
fileTypes = [ ".smc" ".SMC" ".sfc" ".SFC" ".fig" ".FIG" ];
|
fileTypes = [ ".smc" ".SMC" ".sfc" ".SFC" ".fig" ".FIG" ];
|
||||||
package = pkgs.snes9x-gtk;
|
package = pkgs.snes9x-gtk;
|
||||||
binaryName = "snes9x";
|
|
||||||
};
|
};
|
||||||
mgba = {
|
mgba = {
|
||||||
romFolder = "gba";
|
romFolder = "gba";
|
||||||
fileTypes = [ ".gba" ".GBA" ];
|
fileTypes = [ ".gba" ".GBA" ];
|
||||||
package = pkgs.mgba;
|
package = pkgs.mgba;
|
||||||
binaryName = "mgba";
|
|
||||||
};
|
};
|
||||||
mupen64plus = {
|
mupen64plus = {
|
||||||
romFolder = "n64";
|
romFolder = "n64";
|
||||||
fileTypes = [ ".n64" ".N64" ".v64" ".V64" ".z64" ".Z64" ];
|
fileTypes = [ ".n64" ".N64" ".v64" ".V64" ".z64" ".Z64" ];
|
||||||
package = pkgs.mupen64plus;
|
package = pkgs.mupen64plus;
|
||||||
binaryName = "mupen64plus";
|
|
||||||
};
|
};
|
||||||
retroarch = {
|
retroarch = {
|
||||||
romFolder = "retroarch";
|
romFolder = "retroarch";
|
||||||
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
|
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
|
||||||
package = pkgs.retroarch;
|
package = pkgs.retroarch;
|
||||||
binaryName = "retroarch";
|
|
||||||
};
|
};
|
||||||
flycast = {
|
flycast = {
|
||||||
romFolder = "dreamcast";
|
romFolder = "dreamcast";
|
||||||
fileTypes = [ ".gdi" ".GDI" ".cdi" ".CDI" ".chd" ".CHD" ];
|
fileTypes = [ ".gdi" ".GDI" ".cdi" ".CDI" ".chd" ".CHD" ];
|
||||||
package = pkgs.flycast;
|
package = pkgs.flycast;
|
||||||
binaryName = "flycast";
|
|
||||||
};
|
};
|
||||||
citra = {
|
citra = {
|
||||||
romFolder = "3ds";
|
romFolder = "3ds";
|
||||||
fileTypes = [ ".3ds" ".3DS" ".cia" ".CIA" ".cxi" ".CXI" ];
|
fileTypes = [ ".3ds" ".3DS" ".cia" ".CIA" ".cxi" ".CXI" ];
|
||||||
package = pkgs.citra-nightly;
|
package = pkgs.citra-nightly;
|
||||||
binaryName = "citra";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Create parser configuration
|
# Create parser configuration
|
||||||
mkParserConfig = name: emu:
|
mkParserConfig = name: emu:
|
||||||
let
|
let
|
||||||
# Get the default config if it exists
|
|
||||||
defaultConfig = commonEmulatorConfigs.${name} or {};
|
|
||||||
# Merge the provided config with defaults
|
|
||||||
finalConfig = defaultConfig // emu;
|
|
||||||
|
|
||||||
# Use the provided package or fall back to the default if available
|
# Use the provided package or fall back to the default if available
|
||||||
package = emu.package;
|
package = emu.package;
|
||||||
# Get the binary name dynamically
|
# Get the binary name dynamically
|
||||||
binaryName = findMainBinary package (finalConfig.binaryName or "");
|
binaryName = findMainBinary package;
|
||||||
|
|
||||||
orderedConfig = [
|
orderedConfig = [
|
||||||
# Basic parser configuration
|
# Basic parser configuration
|
||||||
@@ -339,7 +315,7 @@ in {
|
|||||||
configs = mapAttrsToList (name: emu:
|
configs = mapAttrsToList (name: emu:
|
||||||
mkParserConfig name (emu // {
|
mkParserConfig name (emu // {
|
||||||
romFolder = if emu.romFolder != "" then emu.romFolder else commonEmulatorConfigs.${name}.romFolder;
|
romFolder = if emu.romFolder != "" then emu.romFolder else commonEmulatorConfigs.${name}.romFolder;
|
||||||
binaryName = if emu.binaryName != "" then emu.binaryName else commonEmulatorConfigs.${name}.binaryName;
|
# binaryName = if emu.binaryName != "" then emu.binaryName else commonEmulatorConfigs.${name}.binaryName;
|
||||||
})
|
})
|
||||||
) (filterAttrs (_: v: v.enable) cfg.emulators);
|
) (filterAttrs (_: v: v.enable) cfg.emulators);
|
||||||
|
|
||||||
|
|||||||
@@ -265,11 +265,6 @@ in {
|
|||||||
else pkgs.${name};
|
else pkgs.${name};
|
||||||
description = "Emulator package";
|
description = "Emulator package";
|
||||||
};
|
};
|
||||||
binaryName = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "";
|
|
||||||
description = "Name of the emulator binary (defaults to automatically detected from package)";
|
|
||||||
};
|
|
||||||
romFolder = mkOption {
|
romFolder = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user