This Nix flake provides a collection of emulators for running games and applications from various platforms on NixOS, without polluting your system-wide configuration. It leverages Nix Flakes for isolated, reproducible environments, making it ideal for retro gaming enthusiasts and developers testing across platforms. Supported emulators include:
- PPSSPP: PlayStation Portable (PSP)
- PCSX2: PlayStation 2 (PS2)
- RPCS3: PlayStation 3 (PS3)
- Xenia Canary: Xbox 360
- Android Emulator: Android (Pixel 7 AVD with Play Store)
- Dolphin: Nintendo GameCube and Wii
- DOSBox: MS-DOS
Whether you’re reliving classics like Midnight Club or testing Android apps, this flake keeps everything neatly contained.
- NixOS: Any recent version (e.g., 23.11 or 24.05) with Flakes enabled.
- Hardware:
- Minimum: Intel i5/Ryzen 5, 8GB RAM, GPU with OpenGL/Vulkan (e.g., GTX 1050).
- Recommended: Ryzen 7, 16GB+ RAM, RTX 3060 for PS3/Xbox 360/Android.
- KVM: Required for Android and Dolphin hardware acceleration (see Setup).
- ROMs: Legally dumped game files (e.g.,
.iso,.exe) from your own media.
-
Enable Flakes (if not already):
- Edit
/etc/nixos/configuration.nixor~/.config/nix/nix.conf:experimental-features = nix-command flakes
- Rebuild:
sudo nixos-rebuild switch.
- Edit
-
Clone the Flake:
git clone <repo_url> cd <project_name>
-
Lock Dependencies:
- Cache inputs and verify hashes:
nix flake lock
- Cache inputs and verify hashes:
-
Optional: Build All Apps:
- Test the build process:
for app in ppsspp pcsx2 rpcs3 xenia android dolphin dosbox; do nix build .#$app; done
- Test the build process:
- Place ROMs in a directory (e.g.,
~/roms/) for easy access. - Connect a gamepad (Xbox/PS) via USB/Bluetooth
- PPSSPP: No extra setup; load ROMs via GUI.
- PCSX2:
- Dump your PS2 BIOS (e.g.,
scph10000.bin) and place it in~/.config/PCSX2/bios/.
- Dump your PS2 BIOS (e.g.,
- RPCS3:
- Download PS3 firmware (
.PUP) from playstation.com. - Install it via RPCS3 GUI (
File > Install Firmware).
- Download PS3 firmware (
- Xenia: No BIOS needed; ensure Wine works (test with
nix-shell -p wineWowPackages.stable --run "wine --version"). - Android Emulator:
- Enable KVM in your NixOS config:
Rebuild:
boot.kernelModules = [ "kvm-amd" ]; # or "kvm-intel" users.users.<your-user>.extraGroups = [ "kvm" ];
sudo nixos-rebuild switch. - AVD (
pixel_7) auto-creates on first run.
- Enable KVM in your NixOS config:
- Dolphin: Enable KVM (as above) for best performance; no BIOS required.
- DOSBox: Optional config file at
~/.dosbox/dosbox.conf.
Run emulators with nix run .#<app-name> from the <project_name> directory. Examples:
- PPSSPP:
nix run .#ppsspp, thenFile > Loadto select a.iso. - PCSX2:
nix run .#pcsx2, configure BIOS, load.isovia GUI. - RPCS3:
nix run .#rpcs3, install firmware, add games via GUI. - Xenia:
nix run .#xenia /path/to/game.iso(follow Xenia docs). - Android:
nix run .#android(first run creates AVD; useadbfor apps). - Dolphin:
nix run .#dolphin, load.isoor.wbfsvia GUI. - DOSBox:
nix run .#dosbox -c "mount c /path/to/game" -c "c:" -c "game.exe".
For all emulators in one shell:
nix shell .#ppsspp .#pcsx2 .#rpcs3 .#xenia .#android .#dolphin .#dosboxAdjust settings via each emulator’s GUI or CLI:
- PPSSPP: Graphics/controls in
Settings. - PCSX2:
Config > Video(Vulkan recommended),Config > Controllers. - RPCS3:
Config > GPU(Vulkan),Config > Pads. - Xenia: Edit
xenia.config.tomlin game directory (see Xenia wiki). - Android: Pass flags (e.g.,
nix run .#android -- -no-audio). - Dolphin:
Options > Graphics Settings(Vulkan/OpenGL). - DOSBox: Edit
~/.dosbox/dosbox.confor pass CLI flags.
Refer to official docs for details:
From <project_name>/:
- Single emulator:
nix run .#<app-name>(e.g.,nix run .#dolphin). - With arguments: Append flags (e.g.,
nix run .#dosbox /path/to/game.exe). - Verify: If an emulator fails, check FAQ or run
nix flake check.
-
Edit
flake.nix:- Add emulators: Copy an
appsentry (e.g.,snes9x = { type = "app"; program = "${pkgs.snes9x}/bin/snes9x"; };). - Update Xenia SHA256: Re-run
nix-prefetch-url --unpack <url>if the release changes. - Adjust Android version: Modify
platformVersions(e.g.,["30"]).
- Add emulators: Copy an
-
Test Changes:
nix flake lockto update dependencies.nix run .#<app-name>to test.
-
Commit:
git add flake.nix && git commit -m "Added SNES9x emulator".
- "Hash mismatch" on Xenia:
- Cause: New Xenia release updated the ZIP.
- Fix: Re-run
nix-prefetch-url --unpack https://github.com/xenia-canary/xenia-canary/releases/latest/download/xenia_canary.zip, updatesha256inflake.nix, thennix flake lock.
- "Failed to create AVD" on Android:
- Cause: KVM not enabled or SDK issue.
- Fix: Verify KVM (
lsmod | grep kvm), check~/.android/avd/pixel_7.avd/logs, ensureandroid-sdkbuilds (nix build .#android).
- "PCSX2 won’t start":
- Cause: Missing BIOS.
- Fix: Place BIOS in
~/.config/PCSX2/bios/.
- "RPCS3 black screen":
- Cause: No firmware.
- Fix: Install
.PUPviaFile > Install Firmware.
- Can I use a stable Nixpkgs version?:
- Yes, change
nixpkgs.urlto"github:NixOS/nixpkgs/nixos-23.11"for stability.
- Yes, change
- How do I add a new emulator?:
- Add to
apps(e.g.,citra = { type = "app"; program = "${pkgs.citra}/bin/citra-qt"; };), thennix flake lock.
- Add to
- Why Android Play Store?:
- Included for app testing; switch to
"google_apis"insystemImageTypesfor a lighter image.
- Included for app testing; switch to
- Performance slow?:
- Check GPU drivers (
nvidia-driveror Mesa), enable KVM, upscale conservatively (e.g., 720p for PS3).
- Check GPU drivers (
Contributions welcome! Fork the repo, make changes, and submit a PR. See “How to Make Changes” for guidance.
MIT License - see LICENSE file.
- NixOS community for Flakes and emulator packages.
- Emulator developers: PPSSPP, PCSX2, RPCS3, Xenia, Android, Dolphin, DOSBox teams.