non srm
This commit is contained in:
@@ -76,6 +76,12 @@ in
|
||||
|
||||
pcsx2.enable = true;
|
||||
mgba.enable = true;
|
||||
|
||||
"Non-SRM Shortcuts" = {
|
||||
enable = true;
|
||||
parserType = "Non-SRM Shortcuts";
|
||||
extraArgs = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
enable = true;
|
||||
autoStart = true;
|
||||
user = "deck";
|
||||
desktopSession = "gnome"; # plasma, plasmaX11, or gamescope-wayland
|
||||
desktopSession = "gnome";
|
||||
};
|
||||
|
||||
steamos = {
|
||||
|
||||
@@ -1,445 +0,0 @@
|
||||
# steam-rom-manager.nix
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.steam-rom-manager;
|
||||
|
||||
# Function to find the main binary in a package
|
||||
findMainBinary = pkg: name:
|
||||
let
|
||||
# First try to find a binary that matches the package name
|
||||
pkgName = pkg.pname or (builtins.parseDrvName pkg.name).name;
|
||||
# binPath = "${pkg}/bin/${pkgName}";
|
||||
|
||||
# Common binary name variations
|
||||
commonVariants = [
|
||||
pkgName # e.g., "citra"
|
||||
"${pkgName}-qt" # e.g., "citra-qt"
|
||||
"${pkgName}-gtk" # e.g., "citra-gtk"
|
||||
"${pkgName}-emu" # e.g., "dolphin-emu"
|
||||
];
|
||||
|
||||
# Check if any of the common variants exist
|
||||
existingVariant = findFirst
|
||||
(variant: builtins.pathExists "${pkg}/bin/${variant}")
|
||||
null
|
||||
commonVariants;
|
||||
in
|
||||
# Use the override if provided, otherwise try to find the binary
|
||||
if name != ""
|
||||
then name
|
||||
else if existingVariant != null
|
||||
then existingVariant
|
||||
else pkgName; # Fallback to package name
|
||||
|
||||
# Common emulator configurations
|
||||
commonEmulatorConfigs = {
|
||||
ryujinx = {
|
||||
romFolder = "switch";
|
||||
fileTypes = [ ".nca" ".NCA" ".nro" ".NRO" ".nso" ".NSO" ".nsp" ".NSP" ".xci" ".XCI" ];
|
||||
};
|
||||
yuzu = {
|
||||
romFolder = "switch";
|
||||
fileTypes = [ ".nsp" ".NSP" ".xci" ".XCI" ];
|
||||
};
|
||||
pcsx2 = {
|
||||
romFolder = "ps2";
|
||||
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
|
||||
};
|
||||
rpcs3 = {
|
||||
romFolder = "ps3";
|
||||
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".pkg" ".PKG" ];
|
||||
};
|
||||
dolphin-emu = {
|
||||
romFolder = "gc";
|
||||
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ".ciso" ".CISO" ];
|
||||
};
|
||||
duckstation = {
|
||||
romFolder = "psx";
|
||||
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ".pbp" ".PBP" ];
|
||||
};
|
||||
melonDS = {
|
||||
romFolder = "nds";
|
||||
fileTypes = [ ".nds" ".NDS" ];
|
||||
};
|
||||
cemu = {
|
||||
romFolder = "wiiu";
|
||||
fileTypes = [ ".wud" ".WUD" ".wux" ".WUX" ".rpx" ".RPX" ];
|
||||
};
|
||||
# Added default configurations
|
||||
xemu = {
|
||||
romFolder = "xbox";
|
||||
fileTypes = [ ".iso" ".ISO" ];
|
||||
};
|
||||
xenia = {
|
||||
romFolder = "xbox360";
|
||||
fileTypes = [ ".iso" ".ISO" ".xex" ".XEX" ];
|
||||
};
|
||||
ppsspp = {
|
||||
romFolder = "psp";
|
||||
fileTypes = [ ".iso" ".ISO" ".cso" ".CSO" ".pbp" ".PBP" ];
|
||||
};
|
||||
vita3k = {
|
||||
romFolder = "psvita";
|
||||
fileTypes = [ ".vpk" ".VPK" ];
|
||||
};
|
||||
mame = {
|
||||
romFolder = "arcade";
|
||||
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ];
|
||||
};
|
||||
dosbox = {
|
||||
romFolder = "dos";
|
||||
fileTypes = [ ".exe" ".EXE" ".bat" ".BAT" ".com" ".COM" ];
|
||||
};
|
||||
pcem = {
|
||||
romFolder = "pcem";
|
||||
fileTypes = [ ".img" ".IMG" ".ima" ".IMA" ];
|
||||
};
|
||||
snes9x = {
|
||||
romFolder = "snes";
|
||||
fileTypes = [ ".smc" ".SMC" ".sfc" ".SFC" ".fig" ".FIG" ];
|
||||
};
|
||||
mgba = {
|
||||
romFolder = "gba";
|
||||
fileTypes = [ ".gba" ".GBA" ];
|
||||
};
|
||||
mupen64plus = {
|
||||
romFolder = "n64";
|
||||
fileTypes = [ ".n64" ".N64" ".v64" ".V64" ".z64" ".Z64" ];
|
||||
};
|
||||
retroarch = {
|
||||
romFolder = "retroarch";
|
||||
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
|
||||
};
|
||||
dolphin-triforce = {
|
||||
romFolder = "triforce";
|
||||
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ];
|
||||
};
|
||||
flycast = {
|
||||
romFolder = "dreamcast";
|
||||
fileTypes = [ ".gdi" ".GDI" ".cdi" ".CDI" ".chd" ".CHD" ];
|
||||
};
|
||||
citra = {
|
||||
romFolder = "3ds";
|
||||
fileTypes = [ ".3ds" ".3DS" ".cia" ".CIA" ".cxi" ".CXI" ];
|
||||
};
|
||||
demul = {
|
||||
romFolder = "demul";
|
||||
fileTypes = [ ".gdi" ".GDI" ".cdi" ".CDI" ".chd" ".CHD" ];
|
||||
};
|
||||
};
|
||||
|
||||
getFileTypes = name: emu:
|
||||
if (emu.fileTypes or []) != []
|
||||
then emu.fileTypes
|
||||
else commonEmulatorConfigs.${name}.fileTypes or [];
|
||||
|
||||
mkParserConfig = name: emu:
|
||||
let
|
||||
# Get the binary name dynamically if not explicitly set
|
||||
binaryName = findMainBinary emu.package emu.binaryName;
|
||||
|
||||
# We create an ordered list of key-value pairs that will maintain the exact order
|
||||
# in the generated JSON output. Each field is documented for clarity.
|
||||
orderedConfig = [
|
||||
# Basic parser configuration
|
||||
{ name = "parserType"; value = "Glob"; }
|
||||
{ name = "configTitle"; value = name; }
|
||||
{ name = "steamDirectory"; value = "\${steamdirglobal}"; }
|
||||
{ name = "romDirectory"; value = "${cfg.romsDirectory}/${if emu.romFolder != "" then emu.romFolder else commonEmulatorConfigs.${name}.romFolder}"; }
|
||||
{ name = "steamCategories"; value = [""]; }
|
||||
|
||||
# Executable configuration
|
||||
{ name = "executableArgs"; value = emu.extraArgs; }
|
||||
{ name = "executableModifier"; value = "\"\${exePath}\""; }
|
||||
{ name = "startInDirectory"; value = "${cfg.romsDirectory}/${if emu.romFolder != "" then emu.romFolder else commonEmulatorConfigs.${name}.romFolder}"; }
|
||||
{ name = "titleModifier"; value = "\${fuzzyTitle}"; }
|
||||
|
||||
# Controller settings
|
||||
{ name = "fetchControllerTemplatesButton"; value = null; }
|
||||
{ name = "removeControllersButton"; value = null; }
|
||||
{ name = "steamInputEnabled"; value = "1"; }
|
||||
|
||||
# Image provider configuration
|
||||
{ name = "imageProviders"; value = [ "sgdb" ]; }
|
||||
{ name = "onlineImageQueries"; value = [ "\${fuzzyTitle}" ]; }
|
||||
{ name = "imagePool"; value = "\${fuzzyTitle}"; }
|
||||
|
||||
# DRM and user account settings
|
||||
{ name = "drmProtect"; value = false; }
|
||||
{ name = "userAccounts"; value = {
|
||||
specifiedAccounts = [ "Global" ];
|
||||
}; }
|
||||
|
||||
# Parser-specific settings
|
||||
{ name = "parserInputs"; value = {
|
||||
glob = "\${title}@(${concatStringsSep "|" (getFileTypes name emu)})";
|
||||
}; }
|
||||
|
||||
# Executable details
|
||||
{ name = "executable"; value = {
|
||||
path = "${emu.package}/bin/${binaryName}";
|
||||
shortcutPassthrough = false;
|
||||
appendArgsToExecutable = true;
|
||||
}; }
|
||||
|
||||
# Title and fuzzy matching configuration
|
||||
{ name = "titleFromVariable"; value = {
|
||||
limitToGroups = [];
|
||||
caseInsensitiveVariables = false;
|
||||
skipFileIfVariableWasNotFound = false;
|
||||
}; }
|
||||
|
||||
{ name = "fuzzyMatch"; value = {
|
||||
replaceDiacritics = true;
|
||||
removeCharacters = true;
|
||||
removeBrackets = true;
|
||||
}; }
|
||||
|
||||
# Controller configuration
|
||||
{ name = "controllers"; value = {
|
||||
ps4 = null;
|
||||
ps5 = null;
|
||||
ps5_edge = null;
|
||||
xbox360 = null;
|
||||
xboxone = null;
|
||||
xboxelite = null;
|
||||
switch_joycon_left = null;
|
||||
switch_joycon_right = null;
|
||||
switch_pro = null;
|
||||
neptune = null;
|
||||
steamcontroller_gordon = null;
|
||||
}; }
|
||||
|
||||
# Image provider API configuration
|
||||
{ name = "imageProviderAPIs"; value = {
|
||||
sgdb = {
|
||||
nsfw = false;
|
||||
humor = false;
|
||||
styles = [];
|
||||
stylesHero = [];
|
||||
stylesLogo = [];
|
||||
stylesIcon = [];
|
||||
imageMotionTypes = [ "static" ];
|
||||
sizes = [];
|
||||
sizesHero = [];
|
||||
sizesTall = null;
|
||||
sizesIcon = [];
|
||||
};
|
||||
}; }
|
||||
|
||||
# Default and local image settings
|
||||
{ name = "defaultImage"; value = {
|
||||
tall = "";
|
||||
long = "";
|
||||
hero = "";
|
||||
logo = "";
|
||||
icon = "";
|
||||
}; }
|
||||
|
||||
{ name = "localImages"; value = {
|
||||
tall = "";
|
||||
long = "";
|
||||
hero = "";
|
||||
logo = "";
|
||||
icon = "";
|
||||
}; }
|
||||
|
||||
# Parser identification
|
||||
{ name = "parserId"; value = name; }
|
||||
{ name = "version"; value = 25; }
|
||||
];
|
||||
|
||||
# Function to convert our ordered list into properly formatted JSON
|
||||
makeOrderedJSON = pairs:
|
||||
let
|
||||
# Create JSON key-value pairs while preserving order
|
||||
joined = builtins.concatStringsSep ","
|
||||
(map (pair: "\"${pair.name}\":${builtins.toJSON pair.value}") pairs);
|
||||
in
|
||||
"{${joined}}";
|
||||
in
|
||||
makeOrderedJSON orderedConfig;
|
||||
|
||||
# Fetch the SVG icon file directly
|
||||
steam-rom-manager-icon = pkgs.fetchurl {
|
||||
name = "steam-rom-manager.svg";
|
||||
url = "https://raw.githubusercontent.com/SteamGridDB/steam-rom-manager/master/src/assets/icons/steam-rom-manager.svg";
|
||||
hash = "sha256-DKzNIs5UhIWAVRTfinvCb8WqeDniPWw9Z08/p/Zpa9E=";
|
||||
};
|
||||
|
||||
# Create our Steam ROM Manager package
|
||||
steam-rom-manager = pkgs.stdenv.mkDerivation {
|
||||
name = "steam-rom-manager-2.5.29";
|
||||
src = pkgs.fetchurl {
|
||||
name = "steam-rom-manager-2.5.29.AppImage";
|
||||
url = "https://github.com/SteamGridDB/steam-rom-manager/releases/download/v2.5.29/Steam-ROM-Manager-2.5.29.AppImage";
|
||||
hash = "sha256-6ZJ+MGIgr2osuQuqD6N9NnPiJFNq/HW6ivG8tyXUhvs=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
|
||||
# Skip unnecessary build phases since we're just installing files
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
dontPatch = true;
|
||||
dontConfigure = true;
|
||||
|
||||
installPhase = ''
|
||||
# Create our directory structure
|
||||
mkdir -p $out/{bin,share/icons/hicolor/scalable/apps,share/applications}
|
||||
|
||||
# Install the AppImage
|
||||
cp $src $out/bin/steam-rom-manager.AppImage
|
||||
chmod +x $out/bin/steam-rom-manager.AppImage
|
||||
|
||||
# Install the SVG icon
|
||||
cp ${steam-rom-manager-icon} $out/share/icons/hicolor/scalable/apps/steam-rom-manager.svg
|
||||
'';
|
||||
};
|
||||
in {
|
||||
options.programs.steam-rom-manager = {
|
||||
enable = mkEnableOption "Steam ROM Manager";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = steam-rom-manager;
|
||||
description = "Steam ROM Manager package";
|
||||
};
|
||||
|
||||
steamUsername = mkOption {
|
||||
type = types.str;
|
||||
description = "Steam username for configuration";
|
||||
};
|
||||
|
||||
romsDirectory = mkOption {
|
||||
type = types.str;
|
||||
default = "${config.home.homeDirectory}/Emulation/roms";
|
||||
description = "Base directory for ROM files";
|
||||
};
|
||||
|
||||
steamDirectory = mkOption {
|
||||
type = types.str;
|
||||
default = "${config.home.homeDirectory}/.local/share/Steam";
|
||||
description = "Steam installation directory";
|
||||
};
|
||||
|
||||
emulators = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
enable = mkEnableOption "emulator configuration";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "Emulator package";
|
||||
};
|
||||
romFolder = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = "Name of the ROM folder (defaults to common configuration)";
|
||||
};
|
||||
fileTypes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "List of ROM file types (defaults to common configuration)";
|
||||
};
|
||||
extraArgs = mkOption {
|
||||
type = types.str;
|
||||
default = "--fullscreen \"\${filePath}\"";
|
||||
description = "Additional emulator arguments";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = {};
|
||||
description = "Emulator configurations";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
home.packages = [ pkgs.appimage-run ]
|
||||
++ mapAttrsToList (_: v: v.package) (filterAttrs (_: v: v.enable) cfg.emulators);
|
||||
|
||||
# Install the icon
|
||||
xdg.dataFile = {
|
||||
"icons/hicolor/scalable/apps/steam-rom-manager.svg".source = steam-rom-manager-icon;
|
||||
};
|
||||
|
||||
# Create the desktop entry
|
||||
xdg.desktopEntries.steam-rom-manager = {
|
||||
name = "Steam ROM Manager";
|
||||
exec = "${pkgs.appimage-run}/bin/appimage-run ${steam-rom-manager}/bin/steam-rom-manager.AppImage";
|
||||
icon = "steam-rom-manager";
|
||||
categories = [ "Game" "Utility" ];
|
||||
type = "Application";
|
||||
terminal = false;
|
||||
comment = "Add ROMs to Steam with artwork";
|
||||
# Add KDE-specific entries
|
||||
settings = {
|
||||
# Ensure it appears in Plasma menus
|
||||
"X-KDE-StartupNotify" = "true";
|
||||
"X-KDE-SubstituteUID" = "false";
|
||||
"X-DBUS-StartupType" = "Unique";
|
||||
};
|
||||
};
|
||||
|
||||
# Configuration files using xdg.configFile
|
||||
xdg.configFile = {
|
||||
# User settings configuration
|
||||
"steam-rom-manager/userData/userSettings.json".text = builtins.toJSON {
|
||||
fuzzyMatcher = {
|
||||
timestamps = {
|
||||
check = 0;
|
||||
download = 0;
|
||||
};
|
||||
verbose = false;
|
||||
filterProviders = true;
|
||||
};
|
||||
environmentVariables = {
|
||||
steamDirectory = cfg.steamDirectory;
|
||||
userAccounts = "\${${cfg.steamUsername}}";
|
||||
romsDirectory = cfg.romsDirectory;
|
||||
retroarchPath = "";
|
||||
raCoresDirectory = "";
|
||||
localImagesDirectory = "";
|
||||
};
|
||||
previewSettings = {
|
||||
retrieveCurrentSteamImages = true;
|
||||
disableCategories = false;
|
||||
deleteDisabledShortcuts = false;
|
||||
imageZoomPercentage = 30;
|
||||
preload = false;
|
||||
hideUserAccount = false;
|
||||
};
|
||||
enabledProviders = [ "sgdb" "steamCDN" ];
|
||||
batchDownloadSize = 50;
|
||||
dnsServers = [];
|
||||
language = "en-US";
|
||||
theme = "Deck";
|
||||
emudeckInstall = false;
|
||||
autoUpdate = false;
|
||||
offlineMode = false;
|
||||
navigationWidth = 0;
|
||||
clearLogOnTest = true;
|
||||
version = 8;
|
||||
};
|
||||
|
||||
# Parser configurations
|
||||
"steam-rom-manager/userData/userConfigurations.json".text =
|
||||
let
|
||||
# Generate configurations
|
||||
configs = mapAttrsToList (name: emu:
|
||||
mkParserConfig name (emu // {
|
||||
romFolder = if emu.romFolder != "" then emu.romFolder else commonEmulatorConfigs.${name}.romFolder;
|
||||
binaryName = if emu.binaryName != "" then emu.binaryName else commonEmulatorConfigs.${name}.binaryName;
|
||||
})
|
||||
) (filterAttrs (_: v: v.enable) cfg.emulators);
|
||||
|
||||
# Join configurations into a valid JSON array
|
||||
configsJson = "[${concatStringsSep "," configs}]";
|
||||
in
|
||||
configsJson;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user