Compare commits

...

2 Commits

Author SHA1 Message Date
Tom Alexander
c173ea87cf
Auto-create persist directories. 2025-03-30 18:32:32 -04:00
Tom Alexander
33f45c56bf
Add dolphin for gamecube and wii. 2025-03-30 17:10:43 -04:00
15 changed files with 314 additions and 100 deletions

View File

@ -35,7 +35,10 @@
homeConfigurations."deck" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit nixgl; };
extraSpecialArgs = {
inherit nixgl;
inherit home-manager;
};
modules = [
{ nixpkgs.overlays = [ nixgl.overlay ]; }

View File

@ -9,6 +9,7 @@
imports = [
./roles/2ship2harkinian
./roles/ares
./roles/dolphin
./roles/global_options
./roles/graphics
./roles/pcsx2
@ -17,6 +18,7 @@
./roles/sm64ex
./roles/steam_rom_manager
./util/unfree_polyfill
./util/persist_symlink
];
home.username = "deck";

View File

@ -10,6 +10,7 @@
config = {
me.ares.enable = true;
me.dolphin.enable = true;
me.graphical = true;
me.optimizations.enable = true;
me.pcsx2.enable = true;

View File

@ -1,4 +1,3 @@
# MANUAL: mkdir -p ~/.persist/.local/share/2ship/saves
{
config,
lib,
@ -39,14 +38,7 @@ in
source = ./files/2ship2harkinian.json;
};
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".local/share/2ship/saves";
method = "symlink";
}
];
};
me.persist.directories = [ ".local/share/2ship/saves" ];
home.persistence."/home/deck/.state" = {
files = [
".local/share/2ship/mm.o2r"

View File

@ -1,4 +1,3 @@
# MANUAL: mkdir -p ~/.persist/.local/share/ares/saves ~/.persist/.local/share/ares/screenshots
{
config,
lib,
@ -34,18 +33,10 @@ in
steam_ares
];
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".local/share/ares/saves";
method = "symlink";
}
{
directory = ".local/share/ares/screenshots";
method = "symlink";
}
];
};
me.persist.directories = [
".local/share/ares/saves"
".local/share/ares/screenshots"
];
home.file.".local/share/ares/settings.bml" = {
source = ./files/settings.bml;
@ -64,6 +55,7 @@ in
original_package =
if config.me.optimizations.enable then
(optimizeWithFlags prev.ares [
# Verified working with ps
"-march=znver2"
"-mtune=znver2"
])

View File

@ -0,0 +1,104 @@
{
config,
lib,
pkgs,
...
}:
let
steam_dolphin = pkgs.writeScriptBin "steam_dolphin" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs.dolphin-emu}/bin/dolphin-emu "''${@}"
'';
in
{
imports = [ ];
options.me = {
dolphin.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install dolphin.";
};
};
config = lib.mkIf config.me.dolphin.enable (
lib.mkMerge [
(lib.mkIf config.me.graphical {
home.packages = with pkgs; [
dolphin-emu
steam_dolphin
];
home.file.".config/dolphin-emu/Dolphin.ini" = {
source = ./files/Dolphin.ini;
};
home.file.".config/dolphin-emu/GFX.ini" = {
source = ./files/GFX.ini;
};
home.file.".config/dolphin-emu/Profiles/GCPad/deck.ini" = {
source = ./files/deck.ini;
};
home.file.".config/dolphin-emu/GCPadNew.ini" = {
source = ./files/GCPadNew.ini;
};
me.persist.directories = [
".local/share/dolphin-emu/Wii" # The system memory
".local/share/dolphin-emu/Load" # Memory card(s)
".local/share/dolphin-emu/GC" # Gamecube
".local/share/dolphin-emu/ScreenShots" # Screenshots
".local/share/dolphin-emu/GBA/Saves" # GameBoy Advanced
];
me.state.directories = [
".cache/dolphin-emu"
".local/share/dolphin-emu/Shaders"
".local/share/dolphin-emu/StateSaves"
];
nixpkgs.overlays = [
(
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
});
original_package =
if config.me.optimizations.enable then
(optimizeWithFlags prev.dolphin-emu [
# Verified working with ps
"-march=znver2"
"-mtune=znver2"
])
else
prev.dolphin-emu;
in
{
dolphin-emu = pkgs.buildEnv {
name = prev.dolphin-emu.name;
paths = [
(config.lib.nixGL.wrap original_package)
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
# We have to use 555 instead of the normal 444 here because the .desktop file ends up inside $HOME on steam deck and desktop files must be either not in $HOME or must be executable, otherwise KDE Plasma refuses to execute them.
postBuild = ''
chmod 0555 $out/share/applications/dolphin-emu.desktop
'';
};
}
)
];
})
]
);
}

View File

@ -0,0 +1,25 @@
[Analytics]
Enabled = False
PermissionAsked = True
[Core]
GFXBackend = Vulkan
# GFXBackend = OGL
SlotA = 8 # GCI Folder (each game gets its own file)
SlotB = 255 # None
WiiSDCard = False
[Display]
RenderToMain = True
[General]
ISOPath0 = /home/deck/.persist/manual/games/nintendo_gamecube/roms
ISOPath1 = /home/deck/.persist/manual/games/nintendo_wii/roms
ISOPaths = 2
RecursiveISOPaths = True
[DSP]
Backend = Cubeb
# Backend = Pulse
# Backend = ALSA
[USBPassthrough]
Devices = 057e:0305
# BluetoothPassthrough must be at the end for the pairings to save properly
[BluetoothPassthrough]
Enabled = True

View File

@ -0,0 +1,32 @@
[GCPad1]
Device = SDL/0/Steam Deck Controller
Buttons/A = `Button S`
Buttons/B = `Button E`
Buttons/X = `Button W`
Buttons/Y = `Button N`
Buttons/Z = `Shoulder R`
Buttons/Start = Start
Main Stick/Up = `Left Y+`
Main Stick/Down = `Left Y-`
Main Stick/Left = `Left X-`
Main Stick/Right = `Left X+`
Main Stick/Modifier = `Thumb L`
Main Stick/Calibration = 100.00 101.96 108.24 120.27 137.87 120.27 108.24 101.96 100.00 101.96 108.24 120.27 141.42 120.27 108.24 101.96 100.00 101.96 108.24 120.27 141.42 120.27 108.24 101.96 100.00 101.96 108.24 120.27 136.32 120.27 108.24 101.96
C-Stick/Up = `Right Y+`
C-Stick/Down = `Right Y-`
C-Stick/Left = `Right X-`
C-Stick/Right = `Right X+`
C-Stick/Modifier = `Thumb R`
C-Stick/Calibration = 100.00 101.96 108.24 120.27 141.42 120.27 108.24 101.96 100.00 101.96 108.24 120.27 136.25 120.27 108.24 101.96 100.00 101.96 108.24 120.27 134.42 120.27 108.24 101.96 100.00 101.96 108.24 120.27 141.42 120.27 108.24 101.96
D-Pad/Up = `Pad N`
D-Pad/Down = `Pad S`
D-Pad/Left = `Pad W`
D-Pad/Right = `Pad E`
Triggers/L-Analog = `Trigger L`
Triggers/R-Analog = `Trigger R`
[GCPad2]
Device = XInput2/0/Virtual core pointer
[GCPad3]
Device = XInput2/0/Virtual core pointer
[GCPad4]
Device = XInput2/0/Virtual core pointer

View File

@ -0,0 +1,16 @@
# [Enhancements]
#MaxAnisotropy = 4 # 16x Anisotropic texture filtering
# MaxAnisotropy = 2 # 4x Anisotropic texture filtering
#MaxAnisotropy = 1 # 2x Anisotropic texture filtering
#MaxAnisotropy = 0 # default
[Settings]
WaitForShadersBeforeStarting = True
# WaitForShadersBeforeStarting = False
# MSAA = 0x00000004 # 4x MSAA
#MSAA = 0x00000002 # 2x MSAA
#MSAA = 0x00000001 # none
SSAA = False
# InternalResolution = 1 # 2x native
#ShaderCompilationMode = 2 # Hybrid ubershaders
ShaderCompilationMode = 3 # Skip
# ShowGraphs = True

View File

@ -0,0 +1,26 @@
[Profile]
Device = SDL/0/Steam Deck Controller
Buttons/A = `Button S`
Buttons/B = `Button E`
Buttons/X = `Button W`
Buttons/Y = `Button N`
Buttons/Z = `Shoulder R`
Buttons/Start = Start
Main Stick/Up = `Left Y+`
Main Stick/Down = `Left Y-`
Main Stick/Left = `Left X-`
Main Stick/Right = `Left X+`
Main Stick/Modifier = `Thumb L`
Main Stick/Calibration = 100.00 101.96 108.24 120.27 137.87 120.27 108.24 101.96 100.00 101.96 108.24 120.27 141.42 120.27 108.24 101.96 100.00 101.96 108.24 120.27 141.42 120.27 108.24 101.96 100.00 101.96 108.24 120.27 136.32 120.27 108.24 101.96
C-Stick/Up = `Right Y+`
C-Stick/Down = `Right Y-`
C-Stick/Left = `Right X-`
C-Stick/Right = `Right X+`
C-Stick/Modifier = `Thumb R`
C-Stick/Calibration = 100.00 101.96 108.24 120.27 141.42 120.27 108.24 101.96 100.00 101.96 108.24 120.27 136.25 120.27 108.24 101.96 100.00 101.96 108.24 120.27 134.42 120.27 108.24 101.96 100.00 101.96 108.24 120.27 141.42 120.27 108.24 101.96
Triggers/L-Analog = `Trigger L`
Triggers/R-Analog = `Trigger R`
D-Pad/Up = `Pad N`
D-Pad/Down = `Pad S`
D-Pad/Left = `Pad W`
D-Pad/Right = `Pad E`

View File

@ -1,4 +1,3 @@
# MANUAL: mkdir -p ~/.persist/.config/PCSX2/memcards ~/.state/.config/PCSX2/cache ~/.state/.config/PCSX2/sstates ~/.state/.config/PCSX2/snaps ~/.state/.config/PCSX2/covers ~/.state/.config/PCSX2/videos
{
config,
lib,
@ -36,38 +35,14 @@ in
source = ./files/PCSX2.ini;
};
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".config/PCSX2/memcards";
method = "symlink";
}
];
};
home.persistence."/home/deck/.state" = {
directories = [
{
directory = ".config/PCSX2/cache";
method = "symlink";
}
{
directory = ".config/PCSX2/sstates";
method = "symlink";
}
{
directory = ".config/PCSX2/snaps";
method = "symlink";
}
{
directory = ".config/PCSX2/covers";
method = "symlink";
}
{
directory = ".config/PCSX2/videos";
method = "symlink";
}
];
};
me.persist.directories = [ ".config/PCSX2/memcards" ];
me.state.directories = [
".config/PCSX2/cache"
".config/PCSX2/sstates"
".config/PCSX2/snaps"
".config/PCSX2/covers"
".config/PCSX2/videos"
];
nixpkgs.overlays = [
(

View File

@ -1,4 +1,3 @@
# MANUAL: mkdir -p ~/.state/.cache/rpcs3 ~/.persist/.config/rpcs3/dev_hdd0 ~/.persist/.config/rpcs3/dev_hdd1 ~/.persist/.config/rpcs3/savestates ~/.persist/.config/rpcs3/dev_usb000 ~/.persist/.config/rpcs3/dev_flash
{
config,
lib,
@ -35,39 +34,14 @@ in
# .config/rpcs3/config.yml
# .config/rpcs3/GuiConfigs/CurrentSettings.ini
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".config/rpcs3/dev_hdd0";
method = "symlink";
}
{
directory = ".config/rpcs3/dev_hdd1";
method = "symlink";
}
{
directory = ".config/rpcs3/savestates";
method = "symlink";
}
{
directory = ".config/rpcs3/dev_usb000";
method = "symlink";
}
{
# Seems to be where the firmware is installed.
directory = ".config/rpcs3/dev_flash";
method = "symlink";
}
];
};
home.persistence."/home/deck/.state" = {
directories = [
{
directory = ".cache/rpcs3";
method = "symlink";
}
];
};
me.persist.directories = [
".config/rpcs3/dev_hdd0"
".config/rpcs3/dev_hdd1"
".config/rpcs3/savestates"
".config/rpcs3/dev_usb000"
".config/rpcs3/dev_flash" # Seems to be where the firmware is installed.
];
me.state.directories = [ ".cache/rpcs3" ];
nixpkgs.overlays = [
(

View File

@ -1,4 +1,3 @@
# MANUAL: mkdir -p ~/.persist/.local/share/soh/Save
{
config,
lib,
@ -39,14 +38,7 @@ in
source = ./files/shipofharkinian.json;
};
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".local/share/soh/Save";
method = "symlink";
}
];
};
me.persist.directories = [ ".local/share/soh/Save" ];
home.persistence."/home/deck/.state" = {
files = [
".local/share/soh/oot.otr"

View File

@ -1,4 +1,3 @@
# MANUAL: mkdir -p ~/.persist/.config/steam-rom-manager/userData
{
stdenv,
config,
@ -29,6 +28,8 @@ in
package
];
me.persist.directories = [ ".config/steam-rom-manager/userData" ];
home.persistence."/home/deck/.persist" = {
directories = [
{

View File

@ -0,0 +1,79 @@
{
config,
lib,
pkgs,
home-manager,
...
}:
{
imports = [ ];
options.me = {
persist.directories = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ ".local/share/dolphin-emu/Wii" ];
description = "List of folders relative to the home directory to persist.";
};
state.directories = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ ".local/share/dolphin-emu/Shaders" ];
description = "List of folders relative to the home directory to keep as state.";
};
};
config = lib.mkMerge [
(lib.mkIf (config.me.persist.directories != [ ]) {
home.persistence."/home/deck/.persist" = {
directories = (
builtins.map (entry: {
directory = entry;
method = "symlink";
}) config.me.persist.directories
);
};
home.activation = {
createPersistDirectories = home-manager.lib.hm.dag.entryAfter [ "writeBoundary" ] (
let
dirlist = lib.strings.escapeShellArgs config.me.persist.directories;
in
''
for dir in ${dirlist} ; do
if [[ ! -d "$HOME/.persist/$dir" ]]; then
$DRY_RUN_CMD mkdir $VERBOSE_ARG -p "$HOME/.persist/$dir"
fi
done
''
);
};
})
(lib.mkIf (config.me.state.directories != [ ]) {
home.persistence."/home/deck/.state" = {
directories = (
builtins.map (entry: {
directory = entry;
method = "symlink";
}) config.me.state.directories
);
};
home.activation = {
createStateDirectories = home-manager.lib.hm.dag.entryAfter [ "writeBoundary" ] (
let
dirlist = lib.strings.escapeShellArgs config.me.state.directories;
in
''
for dir in ${dirlist} ; do
if [[ ! -d "$HOME/.state/$dir" ]]; then
$DRY_RUN_CMD mkdir $VERBOSE_ARG -p "$HOME/.state/$dir"
fi
done
''
);
};
})
];
}