vibes bb
This commit is contained in:
@@ -16,6 +16,25 @@ let
|
||||
"sgdb"
|
||||
"steamCDN"
|
||||
];
|
||||
|
||||
# Parser types that do not scan ROM files and therefore need no package.
|
||||
platformParserTypes = [
|
||||
"Epic"
|
||||
"Legendary"
|
||||
"GOG Galaxy"
|
||||
"Amazon Games"
|
||||
"UPlay"
|
||||
"itch.io"
|
||||
"UWP"
|
||||
"EA Desktop"
|
||||
"Battle.net"
|
||||
"Non-SRM Shortcuts"
|
||||
"Steam"
|
||||
"Manual"
|
||||
];
|
||||
|
||||
isPlatformParser = type: builtins.elem type platformParserTypes;
|
||||
|
||||
in
|
||||
{
|
||||
options.programs.steam-rom-manager = {
|
||||
@@ -251,29 +270,49 @@ in
|
||||
example = "john";
|
||||
description = ''
|
||||
Steam account username used to build the SRM environment-variable
|
||||
reference <literal>''${<username>}</literal> in userSettings.json.
|
||||
reference ''${<username>} in userSettings.json.
|
||||
This must match the account name shown in Steam (not the display name).
|
||||
'';
|
||||
};
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Emulator parser configurations
|
||||
# Emulator / parser configurations
|
||||
# -------------------------------------------------------------------------
|
||||
emulators = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule (
|
||||
{ name, ... }:
|
||||
{ name, config, ... }:
|
||||
{
|
||||
options = {
|
||||
|
||||
enable = lib.mkEnableOption "emulator parser for ${name}";
|
||||
enable = lib.mkEnableOption "parser for ${name}";
|
||||
|
||||
disabled = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Write the parser into userConfigurations.json but mark it as
|
||||
disabled inside SRM (equivalent to unchecking it in the UI).
|
||||
Useful for keeping a config around without having it run.
|
||||
'';
|
||||
};
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
# Resolve against knownEmulators first; fall back to pkgs.<name> so
|
||||
# users can supply any arbitrary emulator key without a code change.
|
||||
default = if knownEmulators ? ${name} then knownEmulators.${name}.package else pkgs.${name};
|
||||
description = "Package providing the emulator binary.";
|
||||
type = lib.types.nullOr lib.types.package;
|
||||
# Resolve against knownEmulators, then try pkgs.<name>, then null
|
||||
# for pure platform parsers that have no associated binary.
|
||||
default =
|
||||
if knownEmulators ? ${name} && knownEmulators.${name} ? package then
|
||||
knownEmulators.${name}.package
|
||||
else if isPlatformParser config.parserType then
|
||||
null
|
||||
else
|
||||
pkgs.${name};
|
||||
description = ''
|
||||
Package providing the emulator binary.
|
||||
Set to null for platform parsers (Epic, GOG, etc.) that do not
|
||||
need a separate package managed by Nix.
|
||||
'';
|
||||
};
|
||||
|
||||
parserType = lib.mkOption {
|
||||
@@ -283,7 +322,12 @@ in
|
||||
knownEmulators.${name}.parserType
|
||||
else
|
||||
"Glob";
|
||||
description = "SRM parser type (usually \"Glob\" for file-based ROMs).";
|
||||
description = ''
|
||||
SRM parser type. One of:
|
||||
Glob, Glob-regex, Manual, Steam, Non-SRM Shortcuts,
|
||||
Epic, Legendary, GOG Galaxy, Amazon Games, UPlay,
|
||||
itch.io, UWP, EA Desktop, Battle.net
|
||||
'';
|
||||
};
|
||||
|
||||
configTitle = lib.mkOption {
|
||||
@@ -296,21 +340,30 @@ in
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
Sub-folder under <option>environmentVariables.romsDirectory</option>
|
||||
that contains ROMs for this emulator. Defaults to the built-in
|
||||
value for known emulators; must be set explicitly for custom ones.
|
||||
Sub-folder under environmentVariables.romsDirectory containing
|
||||
ROMs for this emulator. Defaults to the built-in value for known
|
||||
emulators; must be set explicitly for custom entries.
|
||||
Leave empty for platform/artwork parsers.
|
||||
'';
|
||||
};
|
||||
|
||||
steamCategories = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "" ];
|
||||
default =
|
||||
if knownEmulators ? ${name} && knownEmulators.${name} ? steamCategory then
|
||||
[ knownEmulators.${name}.steamCategory ]
|
||||
else
|
||||
[ "" ];
|
||||
description = "Steam categories / collection tags to apply to shortcuts.";
|
||||
};
|
||||
|
||||
extraArgs = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "--fullscreen \"\${filePath}\"";
|
||||
default =
|
||||
if knownEmulators ? ${name} && knownEmulators.${name} ? executableArgs then
|
||||
knownEmulators.${name}.executableArgs
|
||||
else
|
||||
"\"\${filePath}\"";
|
||||
description = "Command-line arguments passed to the emulator.";
|
||||
};
|
||||
|
||||
@@ -360,8 +413,9 @@ in
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
File extensions matched by the glob parser (e.g. <literal>".iso"</literal>).
|
||||
Defaults to the built-in list for known emulators; must be set for custom ones.
|
||||
File extensions matched by the glob parser (e.g. ".iso").
|
||||
Defaults to the built-in list for known emulators.
|
||||
Leave empty for platform/artwork parsers.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -374,14 +428,33 @@ in
|
||||
appendArgsToExecutable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Append <option>extraArgs</option> to the executable path in the shortcut.";
|
||||
description = "Append extraArgs to the executable path in the shortcut.";
|
||||
};
|
||||
|
||||
# Extra parser-specific inputs (used by platform parsers and Manual).
|
||||
# For Glob parsers the glob pattern is generated automatically from
|
||||
# fileTypes; you do not need to set parserInputs.glob manually.
|
||||
parserInputs = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.anything;
|
||||
default =
|
||||
if knownEmulators ? ${name} && knownEmulators.${name} ? parserInputs then
|
||||
knownEmulators.${name}.parserInputs
|
||||
else
|
||||
{ };
|
||||
description = ''
|
||||
Additional parser-specific input fields merged into parserInputs.
|
||||
For platform parsers (Epic, Legendary, GOG, itch.io, etc.) this
|
||||
carries launcher-specific settings.
|
||||
For Glob parsers the "glob" key is generated automatically.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
default = { };
|
||||
description = "Attribute set of emulator parser configurations keyed by emulator name.";
|
||||
description = "Attribute set of emulator/parser configurations keyed by name.";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user