This commit is contained in:
mjallen18
2025-02-20 10:38:03 -06:00
parent 3467cccc24
commit 76384ebbce
3 changed files with 69 additions and 8 deletions

21
README.md Normal file
View File

@@ -0,0 +1,21 @@
# Steam Rom Manager NixOS Home Manager Configuration
## Usage
### Nix Flake
* Inputs: steam-rom-manager.url = "github:mjallen18/nix-steam-rom-manager";
* ```nixosConfigurations = {
"<hostname>" = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
{
home-manager.users.<username> = { pkgs, ...}: {
imports = [
steam-rom-manager.homeManagerModules.default
];
};
}
];
};
};```

View File

@@ -239,13 +239,31 @@ in {
};
emulators = mkOption {
type = types.attrsOf (types.submodule {
type = types.attrsOf (types.submodule ({ name, ... }: {
options = {
enable = mkEnableOption "emulator configuration";
package = mkOption {
type = types.package;
default = null;
description = "Emulator package (defaults to common configuration if not set)";
default =
if name == "pcsx2" then pkgs.pcsx2
else if name == "citra" then pkgs.citra-nightly
else if name == "yuzu" then pkgs.yuzu
else if name == "ryujinx" then pkgs.ryujinx-greemdev
else if name == "rpcs3" then pkgs.rpcs3
else if name == "dolphin-emu" then pkgs.dolphinEmu
else if name == "duckstation" then pkgs.duckstation
else if name == "melonDS" then pkgs.melonDS
else if name == "cemu" then pkgs.cemu
else if name == "ppsspp" then pkgs.ppsspp
else if name == "mame" then pkgs.mame
else if name == "dosbox" then pkgs.dosbox
else if name == "snes9x" then pkgs.snes9x-gtk
else if name == "mgba" then pkgs.mgba
else if name == "mupen64plus" then pkgs.mupen64plus
else if name == "retroarch" then pkgs.retroarch
else if name == "flycast" then pkgs.flycast
else pkgs.${name};
description = "Emulator package";
};
binaryName = mkOption {
type = types.str;
@@ -268,7 +286,7 @@ in {
description = "Additional emulator arguments";
};
};
});
}));
default = {};
description = "Emulator configurations";
};

View File

@@ -35,96 +35,118 @@ let
romFolder = "switch";
fileTypes = [ ".nca" ".NCA" ".nro" ".NRO" ".nso" ".NSO" ".nsp" ".NSP" ".xci" ".XCI" ];
package = pkgs.ryujinx;
binaryName = "Ryujinx";
};
yuzu = {
romFolder = "switch";
fileTypes = [ ".nsp" ".NSP" ".xci" ".XCI" ];
package = pkgs.yuzu;
binaryName = "yuzu";
};
pcsx2 = {
romFolder = "ps2";
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
package = pkgs.pcsx2;
binaryName = "pcsx2";
};
rpcs3 = {
romFolder = "ps3";
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".pkg" ".PKG" ];
package = pkgs.rpcs3;
binaryName = "rpcs3";
};
dolphin-emu = {
romFolder = "gc";
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ".ciso" ".CISO" ];
package = pkgs.dolphinEmu;
package = pkgs.dolphin-emu;
binaryName = "dolphin-emu";
};
duckstation = {
romFolder = "psx";
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ".pbp" ".PBP" ];
package = pkgs.duckstation;
binaryName = "duckstation";
};
melonDS = {
romFolder = "nds";
fileTypes = [ ".nds" ".NDS" ];
package = pkgs.melonDS;
binaryName = "melonDS";
};
cemu = {
romFolder = "wiiu";
fileTypes = [ ".wud" ".WUD" ".wux" ".WUX" ".rpx" ".RPX" ];
package = pkgs.cemu;
binaryName = "cemu";
};
ppsspp = {
romFolder = "psp";
fileTypes = [ ".iso" ".ISO" ".cso" ".CSO" ".pbp" ".PBP" ];
package = pkgs.ppsspp;
binaryName = "ppsspp";
};
mame = {
romFolder = "arcade";
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ];
package = pkgs.mame;
binaryName = "mame";
};
dosbox = {
romFolder = "dos";
fileTypes = [ ".exe" ".EXE" ".bat" ".BAT" ".com" ".COM" ];
package = pkgs.dosbox;
binaryName = "dosbox";
};
snes9x = {
romFolder = "snes";
fileTypes = [ ".smc" ".SMC" ".sfc" ".SFC" ".fig" ".FIG" ];
package = pkgs.snes9x-gtk;
binaryName = "snes9x";
};
mgba = {
romFolder = "gba";
fileTypes = [ ".gba" ".GBA" ];
package = pkgs.mgba;
binaryName = "mgba";
};
mupen64plus = {
romFolder = "n64";
fileTypes = [ ".n64" ".N64" ".v64" ".V64" ".z64" ".Z64" ];
package = pkgs.mupen64plus;
binaryName = "mupen64plus";
};
retroarch = {
romFolder = "retroarch";
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
package = pkgs.retroarch;
binaryName = "retroarch";
};
flycast = {
romFolder = "dreamcast";
fileTypes = [ ".gdi" ".GDI" ".cdi" ".CDI" ".chd" ".CHD" ];
package = pkgs.flycast;
binaryName = "flycast";
};
citra = {
romFolder = "3ds";
fileTypes = [ ".3ds" ".3DS" ".cia" ".CIA" ".cxi" ".CXI" ];
package = pkgs.citra-nightly;
binaryName = "citra";
};
};
# Create parser configuration
mkParserConfig = name: emu:
let
# Use the provided package or fall back to the default
package = if emu ? package then emu.package else commonEmulatorConfigs.${name}.package;
# 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
package = emu.package;
# Get the binary name dynamically
binaryName = findMainBinary package emu.binaryName;
binaryName = findMainBinary package (finalConfig.binaryName or "");
orderedConfig = [
# Basic parser configuration