From daf35778c50f6b7e0a2c6bfc1f6ed12f604ae637 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 25 May 2025 11:00:31 -0400 Subject: [PATCH 1/9] Add rpcs3 (ps3 emulator). --- nix/configuration/configuration.nix | 1 + nix/configuration/hosts/odo/default.nix | 1 + nix/configuration/hosts/quark/default.nix | 1 + nix/configuration/roles/rpcs3/default.nix | 108 ++++++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 nix/configuration/roles/rpcs3/default.nix diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index f621663..faa014a 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -49,6 +49,7 @@ ./roles/python ./roles/qemu ./roles/reset + ./roles/rpcs3 ./roles/rust ./roles/shikane ./roles/shipwright diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index d5042f7..5b3546b 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -85,6 +85,7 @@ me.pcsx2.enable = true; me.python.enable = true; me.qemu.enable = true; + me.rpcs3.enable = true; me.rust.enable = true; me.shikane.enable = true; me.sops.enable = true; diff --git a/nix/configuration/hosts/quark/default.nix b/nix/configuration/hosts/quark/default.nix index 317912d..a19a0d4 100644 --- a/nix/configuration/hosts/quark/default.nix +++ b/nix/configuration/hosts/quark/default.nix @@ -77,6 +77,7 @@ me.pcsx2.enable = true; me.python.enable = true; me.qemu.enable = true; + me.rpcs3.enable = true; me.rust.enable = true; me.shikane.enable = true; me.sops.enable = true; diff --git a/nix/configuration/roles/rpcs3/default.nix b/nix/configuration/roles/rpcs3/default.nix new file mode 100644 index 0000000..6990584 --- /dev/null +++ b/nix/configuration/roles/rpcs3/default.nix @@ -0,0 +1,108 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ]; + + options.me = { + rpcs3.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install rpcs3."; + }; + }; + + config = lib.mkIf config.me.rpcs3.enable ( + lib.mkMerge [ + (lib.mkIf config.me.graphical { + environment.systemPackages = with pkgs; [ + rpcs3 + ]; + + security.pam.loginLimits = [ + { + domain = "@wheel"; + item = "memlock"; + type = "hard"; + value = "unlimited"; + } + { + domain = "@wheel"; + item = "memlock"; + type = "soft"; + value = "unlimited"; + } + ]; + + # .config/rpcs3/config.yml + # .config/rpcs3/GuiConfigs/CurrentSettings.ini + + environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) { + hideMounts = true; + users.talexander = { + directories = [ + { + # Location of ROMs. + directory = ".config/rpcs3/games"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + directory = ".config/rpcs3/dev_hdd0"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + directory = ".config/rpcs3/dev_hdd1"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + directory = ".config/rpcs3/savestates"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + directory = ".config/rpcs3/dev_usb000"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + # Seems to be where the firmware is installed. + directory = ".config/rpcs3/dev_flash"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + ]; + }; + }; + + environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { + hideMounts = true; + users.talexander = { + directories = [ + { + # Game saves + directory = ".cache/rpcs3"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + ]; + }; + }; + }) + ] + ); +} From 5af4a9594067f7b908365e03fe22ac628330c4de Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 26 May 2025 14:12:49 -0400 Subject: [PATCH 2/9] Add the rpcs3 config.yml file. --- nix/configuration/configuration.nix | 1 + nix/configuration/hosts/odo/default.nix | 1 + nix/configuration/hosts/quark/default.nix | 1 + nix/configuration/roles/iso_mount/default.nix | 45 +++++++++++++++ .../roles/iso_mount/files/iso_mount.bash | 8 +++ .../roles/iso_mount/files/iso_unmount.bash | 8 +++ nix/configuration/roles/rpcs3/default.nix | 55 ++++++++++++++++++- .../roles/rpcs3/files/CurrentSettings.ini | 5 ++ 8 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 nix/configuration/roles/iso_mount/default.nix create mode 100644 nix/configuration/roles/iso_mount/files/iso_mount.bash create mode 100644 nix/configuration/roles/iso_mount/files/iso_unmount.bash create mode 100644 nix/configuration/roles/rpcs3/files/CurrentSettings.ini diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index faa014a..a18d814 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -32,6 +32,7 @@ ./roles/graphics ./roles/hydra ./roles/iso + ./roles/iso_mount ./roles/kanshi ./roles/kodi ./roles/kubernetes diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index 5b3546b..11be98b 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -75,6 +75,7 @@ me.gpg.enable = true; me.graphical = true; me.graphics_card_type = "amd"; + me.iso_mount.enable = true; me.kanshi.enable = false; me.kubernetes.enable = true; me.latex.enable = true; diff --git a/nix/configuration/hosts/quark/default.nix b/nix/configuration/hosts/quark/default.nix index a19a0d4..30a5233 100644 --- a/nix/configuration/hosts/quark/default.nix +++ b/nix/configuration/hosts/quark/default.nix @@ -66,6 +66,7 @@ me.gpg.enable = true; me.graphical = true; me.graphics_card_type = "amd"; + me.iso_mount.enable = true; me.kanshi.enable = false; me.kubernetes.enable = true; me.latex.enable = true; diff --git a/nix/configuration/roles/iso_mount/default.nix b/nix/configuration/roles/iso_mount/default.nix new file mode 100644 index 0000000..32c0af6 --- /dev/null +++ b/nix/configuration/roles/iso_mount/default.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + iso_mount = + (pkgs.writeScriptBin "iso_mount" (builtins.readFile ./files/iso_mount.bash)).overrideAttrs + (old: { + buildCommand = "${old.buildCommand}\n patchShebangs $out"; + + }); + iso_unmount = + (pkgs.writeScriptBin "iso_unmount" (builtins.readFile ./files/iso_unmount.bash)).overrideAttrs + (old: { + buildCommand = "${old.buildCommand}\n patchShebangs $out"; + + }); + +in +{ + imports = [ ]; + + options.me = { + iso_mount.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install iso_mount."; + }; + }; + + config = lib.mkIf config.me.iso_mount.enable ( + lib.mkMerge [ + { + environment.systemPackages = [ + iso_mount + iso_unmount + ]; + } + ] + ); +} diff --git a/nix/configuration/roles/iso_mount/files/iso_mount.bash b/nix/configuration/roles/iso_mount/files/iso_mount.bash new file mode 100644 index 0000000..143e14d --- /dev/null +++ b/nix/configuration/roles/iso_mount/files/iso_mount.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Mount a full-disk image as a loopback device so you can mount individual partitions from inside of it. +set -euo pipefail +IFS=$'\n\t' +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +exec udisksctl loop-setup -r -f "${@}" diff --git a/nix/configuration/roles/iso_mount/files/iso_unmount.bash b/nix/configuration/roles/iso_mount/files/iso_unmount.bash new file mode 100644 index 0000000..1771e21 --- /dev/null +++ b/nix/configuration/roles/iso_mount/files/iso_unmount.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Mount a full-disk image as a loopback device so you can mount individual partitions from inside of it. +set -euo pipefail +IFS=$'\n\t' +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +exec udisksctl loop-delete "${@}" diff --git a/nix/configuration/roles/rpcs3/default.nix b/nix/configuration/roles/rpcs3/default.nix index 6990584..fbb6d9a 100644 --- a/nix/configuration/roles/rpcs3/default.nix +++ b/nix/configuration/roles/rpcs3/default.nix @@ -5,6 +5,14 @@ ... }: +let + rpcs3_config_yaml = ( + pkgs.writeTextFile { + name = "config.yml"; + text = lib.generators.toYAML { } config.me.rpcs3.config; + } + ); +in { imports = [ ]; @@ -15,6 +23,29 @@ example = true; description = "Whether we want to install rpcs3."; }; + + rpcs3.config = lib.mkOption { + type = lib.types.nullOr lib.types.attrs; + default = { + VFS = { + "Enable /host_root/" = false; + }; + Video = { + "Write Color Buffers" = false; + VSync = true; + "Performance Overlay" = { + Enabled = true; + }; + }; + Miscellaneous = { + "Pause emulation on RPCS3 focus loss" = true; + "Start games in fullscreen mode" = true; + "Pause Emulation During Home Menu" = true; + }; + }; + example = null; + description = "RPCS3's config.yml in nix form."; + }; }; config = lib.mkIf config.me.rpcs3.enable ( @@ -39,8 +70,21 @@ } ]; - # .config/rpcs3/config.yml - # .config/rpcs3/GuiConfigs/CurrentSettings.ini + me.rpcs3.config.Core."Use LLVM CPU" = + lib.mkIf (config.me.optimizations.enable) config.me.optimizations.arch; + + home-manager.users.talexander = + { pkgs, ... }: + { + home.file.".config/rpcs3/config.yml" = lib.mkIf (config.me.rpcs3.config != null) { + source = rpcs3_config_yaml; + }; + home.file.".config/rpcs3/GuiConfigs/CurrentSettings.ini" = { + source = ./files/CurrentSettings.ini; + }; + }; + + # TODO?: .config/rpcs3/GuiConfigs/CurrentSettings.ini environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) { hideMounts = true; @@ -84,6 +128,13 @@ group = "talexander"; mode = "0755"; } + { + # Controller config. + directory = ".config/rpcs3/input_configs"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } ]; }; }; diff --git a/nix/configuration/roles/rpcs3/files/CurrentSettings.ini b/nix/configuration/roles/rpcs3/files/CurrentSettings.ini new file mode 100644 index 0000000..b6354c4 --- /dev/null +++ b/nix/configuration/roles/rpcs3/files/CurrentSettings.ini @@ -0,0 +1,5 @@ +[Meta] +currentStylesheet=Darker Style by TheMitoSan + +[main_window] +infoBoxEnabledWelcome=false From 199bb38dfb9c20ea35cfc1321dcbfafd2d1eaa7f Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 26 May 2025 14:47:59 -0400 Subject: [PATCH 3/9] Fix rpcs3 config. --- nix/configuration/hosts/quark/default.nix | 177 +++++++++++----------- nix/configuration/roles/rpcs3/default.nix | 21 +-- 2 files changed, 99 insertions(+), 99 deletions(-) diff --git a/nix/configuration/hosts/quark/default.nix b/nix/configuration/hosts/quark/default.nix index 30a5233..672428a 100644 --- a/nix/configuration/hosts/quark/default.nix +++ b/nix/configuration/hosts/quark/default.nix @@ -13,96 +13,101 @@ ./wifi.nix ]; - # Generate with `head -c4 /dev/urandom | od -A none -t x4` - networking.hostId = "47ee7d7c"; + config = { + # Generate with `head -c4 /dev/urandom | od -A none -t x4` + networking.hostId = "47ee7d7c"; - networking.hostName = "quark"; # Define your hostname. + networking.hostName = "quark"; # Define your hostname. - time.timeZone = "America/New_York"; - i18n.defaultLocale = "en_US.UTF-8"; + time.timeZone = "America/New_York"; + i18n.defaultLocale = "en_US.UTF-8"; - me.secureBoot.enable = true; + me.secureBoot.enable = true; - me.optimizations = { - enable = true; - arch = "znver5"; - system_features = [ - "gccarch-znver4" - "gccarch-znver5" - "gccarch-skylake" - # "gccarch-alderlake" missing WAITPKG - "gccarch-x86-64-v3" - "gccarch-x86-64-v4" - "benchmark" - "big-parallel" - "kvm" - "nixos-test" + me.optimizations = { + enable = true; + arch = "znver5"; + system_features = [ + "gccarch-znver4" + "gccarch-znver5" + "gccarch-skylake" + # "gccarch-alderlake" missing WAITPKG + "gccarch-x86-64-v3" + "gccarch-x86-64-v4" + "benchmark" + "big-parallel" + "kvm" + "nixos-test" + ]; + }; + + # Early KMS + boot.initrd.kernelModules = [ "amdgpu" ]; + + # Mount tmpfs at /tmp + boot.tmp.useTmpfs = true; + + # Enable TRIM + # services.fstrim.enable = lib.mkDefault true; + + # RPCS3 has difficulty with znver5 + me.rpcs3.config.Core."Use LLVM CPU" = "znver4"; + + me.alacritty.enable = true; + me.ansible.enable = true; + me.ares.enable = true; + me.bluetooth.enable = true; + me.chromecast.enable = true; + me.chromium.enable = true; + me.docker.enable = true; + me.ecc.enable = true; + me.emacs_flavor = "full"; + me.firefox.enable = true; + me.flux.enable = true; + me.gcloud.enable = true; + me.git.config = ../../roles/git/files/gitconfig_home; + me.gnuplot.enable = true; + me.gpg.enable = true; + me.graphical = true; + me.graphics_card_type = "amd"; + me.iso_mount.enable = true; + me.kanshi.enable = false; + me.kubernetes.enable = true; + me.latex.enable = true; + me.launch_keyboard.enable = true; + me.lvfs.enable = true; + me.media.enable = true; + me.nix_index.enable = true; + me.nix_worker.enable = true; + me.pcsx2.enable = true; + me.python.enable = true; + me.qemu.enable = true; + me.rpcs3.enable = true; + me.rust.enable = true; + me.shikane.enable = true; + me.sops.enable = true; + me.sound.enable = true; + me.steam.enable = true; + me.steam_run_free.enable = true; + me.sway.enable = true; + me.tekton.enable = true; + me.terraform.enable = true; + me.thunderbolt.enable = true; + me.vnc_client.enable = true; + me.vscode.enable = true; + me.wasm.enable = true; + me.waybar.enable = true; + me.wireguard.activated = [ + "drmario" + "wgh" + "colo" ]; + me.wireguard.deactivated = [ "wgf" ]; + me.zrepl.enable = true; + me.zsh.enable = true; + + me.sm64ex.enable = true; + me.shipwright.enable = true; + me.ship2harkinian.enable = true; }; - - # Early KMS - boot.initrd.kernelModules = [ "amdgpu" ]; - - # Mount tmpfs at /tmp - boot.tmp.useTmpfs = true; - - # Enable TRIM - # services.fstrim.enable = lib.mkDefault true; - - me.alacritty.enable = true; - me.ansible.enable = true; - me.ares.enable = true; - me.bluetooth.enable = true; - me.chromecast.enable = true; - me.chromium.enable = true; - me.docker.enable = true; - me.ecc.enable = true; - me.emacs_flavor = "full"; - me.firefox.enable = true; - me.flux.enable = true; - me.gcloud.enable = true; - me.git.config = ../../roles/git/files/gitconfig_home; - me.gnuplot.enable = true; - me.gpg.enable = true; - me.graphical = true; - me.graphics_card_type = "amd"; - me.iso_mount.enable = true; - me.kanshi.enable = false; - me.kubernetes.enable = true; - me.latex.enable = true; - me.launch_keyboard.enable = true; - me.lvfs.enable = true; - me.media.enable = true; - me.nix_index.enable = true; - me.nix_worker.enable = true; - me.pcsx2.enable = true; - me.python.enable = true; - me.qemu.enable = true; - me.rpcs3.enable = true; - me.rust.enable = true; - me.shikane.enable = true; - me.sops.enable = true; - me.sound.enable = true; - me.steam.enable = true; - me.steam_run_free.enable = true; - me.sway.enable = true; - me.tekton.enable = true; - me.terraform.enable = true; - me.thunderbolt.enable = true; - me.vnc_client.enable = true; - me.vscode.enable = true; - me.wasm.enable = true; - me.waybar.enable = true; - me.wireguard.activated = [ - "drmario" - "wgh" - "colo" - ]; - me.wireguard.deactivated = [ "wgf" ]; - me.zrepl.enable = true; - me.zsh.enable = true; - - me.sm64ex.enable = true; - me.shipwright.enable = true; - me.ship2harkinian.enable = true; } diff --git a/nix/configuration/roles/rpcs3/default.nix b/nix/configuration/roles/rpcs3/default.nix index fbb6d9a..ef5aed2 100644 --- a/nix/configuration/roles/rpcs3/default.nix +++ b/nix/configuration/roles/rpcs3/default.nix @@ -6,12 +6,8 @@ }: let - rpcs3_config_yaml = ( - pkgs.writeTextFile { - name = "config.yml"; - text = lib.generators.toYAML { } config.me.rpcs3.config; - } - ); + rpcs3_config_yaml = settingsFormat.generate "config.yml" config.me.rpcs3.config; + settingsFormat = pkgs.formats.yaml { }; in { imports = [ ]; @@ -24,9 +20,13 @@ in description = "Whether we want to install rpcs3."; }; - rpcs3.config = lib.mkOption { - type = lib.types.nullOr lib.types.attrs; + rpcs3.config = lib.mkOption rec { + apply = lib.recursiveUpdate default; + inherit (settingsFormat) type; default = { + Core = { + "Use LLVM CPU" = lib.mkIf (config.me.optimizations.enable) config.me.optimizations.arch; + }; VFS = { "Enable /host_root/" = false; }; @@ -70,9 +70,6 @@ in } ]; - me.rpcs3.config.Core."Use LLVM CPU" = - lib.mkIf (config.me.optimizations.enable) config.me.optimizations.arch; - home-manager.users.talexander = { pkgs, ... }: { @@ -84,8 +81,6 @@ in }; }; - # TODO?: .config/rpcs3/GuiConfigs/CurrentSettings.ini - environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) { hideMounts = true; users.talexander = { From 5c17148635008847e87c21059c40e12cd7a1cf09 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 26 May 2025 15:32:10 -0400 Subject: [PATCH 4/9] Write color buffers to fix black screen on Demon's Souls. --- nix/configuration/roles/rpcs3/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/configuration/roles/rpcs3/default.nix b/nix/configuration/roles/rpcs3/default.nix index ef5aed2..0f55ac4 100644 --- a/nix/configuration/roles/rpcs3/default.nix +++ b/nix/configuration/roles/rpcs3/default.nix @@ -31,7 +31,7 @@ in "Enable /host_root/" = false; }; Video = { - "Write Color Buffers" = false; + "Write Color Buffers" = true; VSync = true; "Performance Overlay" = { Enabled = true; From e28c7f8968808f4e8e907280806ef453b2f5da48 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 26 May 2025 15:46:10 -0400 Subject: [PATCH 5/9] Persist icons and play stats. --- nix/configuration/roles/rpcs3/default.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nix/configuration/roles/rpcs3/default.nix b/nix/configuration/roles/rpcs3/default.nix index 0f55ac4..3be8efc 100644 --- a/nix/configuration/roles/rpcs3/default.nix +++ b/nix/configuration/roles/rpcs3/default.nix @@ -130,6 +130,22 @@ in group = "talexander"; mode = "0755"; } + { + # Game icons. + directory = ".config/rpcs3/Icons"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + ]; + files = [ + { + # play times and recently played + file = ".config/rpcs3/GuiConfigs/persistent_settings.dat"; + parentDirectory = { + mode = "0755"; + }; + } ]; }; }; From 18cb7589868a33a7a44a1a2675407de18b33bd6a Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 26 May 2025 16:02:34 -0400 Subject: [PATCH 6/9] Fix lag in the home button menu. --- nix/configuration/roles/rpcs3/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/configuration/roles/rpcs3/default.nix b/nix/configuration/roles/rpcs3/default.nix index 3be8efc..f034f6d 100644 --- a/nix/configuration/roles/rpcs3/default.nix +++ b/nix/configuration/roles/rpcs3/default.nix @@ -34,13 +34,13 @@ in "Write Color Buffers" = true; VSync = true; "Performance Overlay" = { - Enabled = true; + Enabled = false; }; }; Miscellaneous = { "Pause emulation on RPCS3 focus loss" = true; "Start games in fullscreen mode" = true; - "Pause Emulation During Home Menu" = true; + "Pause Emulation During Home Menu" = false; # true makes the home menu slow }; }; example = null; From 3a4344a112292584f509a288fcd488917a6dce60 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 26 May 2025 16:26:48 -0400 Subject: [PATCH 7/9] Copy the RPCS3 setup improvements to the steam deck config. --- .../configuration/roles/rpcs3/default.nix | 42 ++++++++++++++++++- .../roles/rpcs3/files/CurrentSettings.ini | 5 +++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 nix/steam_deck/configuration/roles/rpcs3/files/CurrentSettings.ini diff --git a/nix/steam_deck/configuration/roles/rpcs3/default.nix b/nix/steam_deck/configuration/roles/rpcs3/default.nix index dc944ab..6e72ffc 100644 --- a/nix/steam_deck/configuration/roles/rpcs3/default.nix +++ b/nix/steam_deck/configuration/roles/rpcs3/default.nix @@ -10,6 +10,9 @@ let export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib" exec ${pkgs.rpcs3}/bin/rpcs3 "''${@}" ''; + rpcs3_config_yaml = settingsFormat.generate "config.yml" config.me.rpcs3.config; + settingsFormat = pkgs.formats.yaml { }; + in { imports = [ ]; @@ -21,6 +24,33 @@ in example = true; description = "Whether we want to install rpcs3."; }; + + rpcs3.config = lib.mkOption rec { + apply = lib.recursiveUpdate default; + inherit (settingsFormat) type; + default = { + Core = { + "Use LLVM CPU" = "znver2"; + }; + VFS = { + "Enable /host_root/" = false; + }; + Video = { + "Write Color Buffers" = true; + VSync = true; + "Performance Overlay" = { + Enabled = false; + }; + }; + Miscellaneous = { + "Pause emulation on RPCS3 focus loss" = true; + "Start games in fullscreen mode" = true; + "Pause Emulation During Home Menu" = false; # true makes the home menu slow + }; + }; + example = null; + description = "RPCS3's config.yml in nix form."; + }; }; config = lib.mkIf config.me.rpcs3.enable ( @@ -31,15 +61,23 @@ in steam_rpcs3 ]; - # .config/rpcs3/config.yml - # .config/rpcs3/GuiConfigs/CurrentSettings.ini + home.file.".config/rpcs3/config.yml" = lib.mkIf (config.me.rpcs3.config != null) { + source = rpcs3_config_yaml; + }; + home.file.".config/rpcs3/GuiConfigs/CurrentSettings.ini" = { + source = ./files/CurrentSettings.ini; + }; + # TODO: Persist file .config/rpcs3/GuiConfigs/persistent_settings.dat # play times and recently played me.persist.directories = [ + ".config/rpcs3/games" # Location of ROMs. ".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. + ".config/rpcs3/input_configs" # Controller config. + ".config/rpcs3/Icons" # Game icons. ]; me.state.directories = [ ".cache/rpcs3" ]; diff --git a/nix/steam_deck/configuration/roles/rpcs3/files/CurrentSettings.ini b/nix/steam_deck/configuration/roles/rpcs3/files/CurrentSettings.ini new file mode 100644 index 0000000..b6354c4 --- /dev/null +++ b/nix/steam_deck/configuration/roles/rpcs3/files/CurrentSettings.ini @@ -0,0 +1,5 @@ +[Meta] +currentStylesheet=Darker Style by TheMitoSan + +[main_window] +infoBoxEnabledWelcome=false From 38a1168a325b577fe56c2f7c0b3803ee50b9e2ae Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 26 May 2025 18:23:10 -0400 Subject: [PATCH 8/9] Persist persistent_settings.dat on steam deck. --- nix/steam_deck/configuration/roles/rpcs3/default.nix | 4 +++- .../configuration/util/persist_symlink/default.nix | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/nix/steam_deck/configuration/roles/rpcs3/default.nix b/nix/steam_deck/configuration/roles/rpcs3/default.nix index 6e72ffc..8ca37dc 100644 --- a/nix/steam_deck/configuration/roles/rpcs3/default.nix +++ b/nix/steam_deck/configuration/roles/rpcs3/default.nix @@ -68,7 +68,6 @@ in source = ./files/CurrentSettings.ini; }; - # TODO: Persist file .config/rpcs3/GuiConfigs/persistent_settings.dat # play times and recently played me.persist.directories = [ ".config/rpcs3/games" # Location of ROMs. ".config/rpcs3/dev_hdd0" @@ -79,6 +78,9 @@ in ".config/rpcs3/input_configs" # Controller config. ".config/rpcs3/Icons" # Game icons. ]; + me.persist.files = [ + ".config/rpcs3/GuiConfigs/persistent_settings.dat" # play times and recently played + ]; me.state.directories = [ ".cache/rpcs3" ]; nixpkgs.overlays = [ diff --git a/nix/steam_deck/configuration/util/persist_symlink/default.nix b/nix/steam_deck/configuration/util/persist_symlink/default.nix index 0860d66..6339bab 100644 --- a/nix/steam_deck/configuration/util/persist_symlink/default.nix +++ b/nix/steam_deck/configuration/util/persist_symlink/default.nix @@ -16,6 +16,12 @@ example = [ ".local/share/dolphin-emu/Wii" ]; description = "List of folders relative to the home directory to persist."; }; + persist.files = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + example = [ ".local/share/foo.sqlite3" ]; + description = "List of files relative to the home directory to persist."; + }; state.directories = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ ]; @@ -50,6 +56,11 @@ ); }; }) + (lib.mkIf (config.me.persist.files != [ ]) { + home.persistence."/home/deck/.persist" = { + files = config.me.persist.files; + }; + }) (lib.mkIf (config.me.state.directories != [ ]) { home.persistence."/home/deck/.state" = { directories = ( From 9008d9b7c62df9d1ffc1e5e539ddd38e44e418e5 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 26 May 2025 19:25:10 -0400 Subject: [PATCH 9/9] Clean up steam rom manager. --- .../configuration/roles/steam_rom_manager/default.nix | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/nix/steam_deck/configuration/roles/steam_rom_manager/default.nix b/nix/steam_deck/configuration/roles/steam_rom_manager/default.nix index 082781f..864ffdd 100644 --- a/nix/steam_deck/configuration/roles/steam_rom_manager/default.nix +++ b/nix/steam_deck/configuration/roles/steam_rom_manager/default.nix @@ -24,21 +24,12 @@ in config = lib.mkIf config.me.steam_rom_manager.enable ( lib.mkMerge [ (lib.mkIf config.me.graphical { - home.packages = with pkgs; [ + home.packages = [ package ]; me.persist.directories = [ ".config/steam-rom-manager/userData" ]; - home.persistence."/home/deck/.persist" = { - directories = [ - { - directory = ".config/steam-rom-manager/userData"; - method = "symlink"; - } - ]; - }; - # TODO: Install a fully configured /home/deck/.persist/.config/steam-rom-manager/userData/userConfigurations.json (which contains the parser definitions) and /home/deck/.persist/.config/steam-rom-manager/userData/userSettings.json (which contains the applications settings like steam directory). # TODO: Maybe only persist /home/deck/.persist/.config/steam-rom-manager/userData/artworkBackups and /home/deck/.persist/.config/steam-rom-manager/userData/artworkCache.json after the parser config is being installed.