diff --git a/nix/steam_deck/configuration/home.nix b/nix/steam_deck/configuration/home.nix index ecc0307..03d5dc8 100644 --- a/nix/steam_deck/configuration/home.nix +++ b/nix/steam_deck/configuration/home.nix @@ -10,6 +10,7 @@ ./roles/2ship2harkinian ./roles/graphics ./roles/pcsx2 + ./roles/rpcs3 ./roles/shipwright ./roles/sm64ex ./roles/steam_rom_manager diff --git a/nix/steam_deck/configuration/hosts/deck/default.nix b/nix/steam_deck/configuration/hosts/deck/default.nix index c99526d..63966d0 100644 --- a/nix/steam_deck/configuration/hosts/deck/default.nix +++ b/nix/steam_deck/configuration/hosts/deck/default.nix @@ -11,6 +11,7 @@ config = { me.graphical = true; me.pcsx2.enable = true; + me.rpcs3.enable = true; me.ship2harkinian.enable = true; me.shipwright.enable = true; me.sm64ex.enable = true; diff --git a/nix/steam_deck/configuration/roles/rpcs3/default.nix b/nix/steam_deck/configuration/roles/rpcs3/default.nix new file mode 100644 index 0000000..6d5a6bf --- /dev/null +++ b/nix/steam_deck/configuration/roles/rpcs3/default.nix @@ -0,0 +1,94 @@ +# 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, + pkgs, + ... +}: + +let + steam_rpcs3 = pkgs.writeScriptBin "steam_rpcs3" '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib" + exec ${pkgs.rpcs3}/bin/rpcs3 + ''; +in +{ + 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 { + home.packages = with pkgs; [ + rpcs3 + steam_rpcs3 + ]; + + # .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"; + } + ]; + }; + + nixpkgs.overlays = [ + (final: prev: { + rpcs3 = pkgs.buildEnv { + name = prev.rpcs3.name; + paths = [ + (config.lib.nixGL.wrap prev.rpcs3) + ]; + 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/PCSX2.desktop + # ''; + }; + }) + ]; + }) + ] + ); +}