From 52490457f078cb029ef2427333480c7f3865bcb5 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 28 Jun 2025 20:49:59 -0400 Subject: [PATCH] Install shadps4. --- nix/configuration/configuration.nix | 1 + nix/configuration/hosts/odo/default.nix | 1 + nix/configuration/hosts/quark/default.nix | 1 + .../roles/optimized_build/default.nix | 1 + nix/configuration/roles/rpcs3/default.nix | 1 - nix/configuration/roles/shadps4/default.nix | 112 ++++++++++++++++++ .../roles/shadps4/files/config.toml | 4 + 7 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 nix/configuration/roles/shadps4/default.nix create mode 100644 nix/configuration/roles/shadps4/files/config.toml diff --git a/nix/configuration/configuration.nix b/nix/configuration/configuration.nix index 3aae101..7ce42e5 100644 --- a/nix/configuration/configuration.nix +++ b/nix/configuration/configuration.nix @@ -52,6 +52,7 @@ ./roles/reset ./roles/rpcs3 ./roles/rust + ./roles/shadps4 ./roles/shikane ./roles/shipwright ./roles/sm64ex diff --git a/nix/configuration/hosts/odo/default.nix b/nix/configuration/hosts/odo/default.nix index 11be98b..8ddbf38 100644 --- a/nix/configuration/hosts/odo/default.nix +++ b/nix/configuration/hosts/odo/default.nix @@ -88,6 +88,7 @@ me.qemu.enable = true; me.rpcs3.enable = true; me.rust.enable = true; + me.shadps4.enable = true; me.shikane.enable = true; me.sops.enable = true; me.sound.enable = true; diff --git a/nix/configuration/hosts/quark/default.nix b/nix/configuration/hosts/quark/default.nix index 672428a..b20526f 100644 --- a/nix/configuration/hosts/quark/default.nix +++ b/nix/configuration/hosts/quark/default.nix @@ -84,6 +84,7 @@ me.qemu.enable = true; me.rpcs3.enable = true; me.rust.enable = true; + me.shadps4.enable = true; me.shikane.enable = true; me.sops.enable = true; me.sound.enable = true; diff --git a/nix/configuration/roles/optimized_build/default.nix b/nix/configuration/roles/optimized_build/default.nix index 12fa9ad..1996bcb 100644 --- a/nix/configuration/roles/optimized_build/default.nix +++ b/nix/configuration/roles/optimized_build/default.nix @@ -132,6 +132,7 @@ redis valkey nix-serve-ng + rapidjson ; }) ]; diff --git a/nix/configuration/roles/rpcs3/default.nix b/nix/configuration/roles/rpcs3/default.nix index 7625096..2182cd3 100644 --- a/nix/configuration/roles/rpcs3/default.nix +++ b/nix/configuration/roles/rpcs3/default.nix @@ -174,7 +174,6 @@ in users.talexander = { directories = [ { - # Game saves directory = ".cache/rpcs3"; user = "talexander"; group = "talexander"; diff --git a/nix/configuration/roles/shadps4/default.nix b/nix/configuration/roles/shadps4/default.nix new file mode 100644 index 0000000..8615466 --- /dev/null +++ b/nix/configuration/roles/shadps4/default.nix @@ -0,0 +1,112 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ]; + + options.me = { + shadps4.enable = lib.mkOption { + type = lib.types.bool; + default = false; + example = true; + description = "Whether we want to install shadps4."; + }; + }; + + config = lib.mkIf config.me.shadps4.enable ( + lib.mkMerge [ + (lib.mkIf config.me.graphical { + environment.systemPackages = with pkgs; [ + shadps4 + ]; + + home-manager.users.talexander = + { pkgs, ... }: + { + home.file.".local/share/shadPS4/config.toml" = { + source = ./files/config.toml; + }; + }; + + environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) { + hideMounts = true; + users.talexander = { + directories = [ + { + # Location of ROMs. + directory = ".local/share/shadPS4/games"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + # Firmware. + directory = ".local/share/shadPS4/sys_modules"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + # Game saves. + directory = ".local/share/shadPS4/savedata"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + { + # DLC. + directory = ".local/share/shadPS4/addcont"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + ]; + files = [ + { + # play times and recently played + file = ".local/share/shadPS4/play_time.txt"; + parentDirectory = { + mode = "0755"; + }; + } + ]; + }; + }; + + environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { + hideMounts = true; + users.talexander = { + directories = [ + { + # Cache. + directory = ".local/share/shadPS4/data"; + user = "talexander"; + group = "talexander"; + mode = "0755"; + } + ]; + }; + }; + + nixpkgs.overlays = [ + (final: prev: { + shadps4 = prev.shadps4.overrideAttrs (old: { + version = "0.9.0"; + src = final.fetchFromGitHub { + owner = "AzaharPlus"; + repo = "shadPS4Plus"; + tag = "SHADPS4PLUS_0_9_0_A"; + hash = "sha256-ZwP+bOE4roWt51Ii53blDZzdq/SxK4Q69I4rLCNARLA="; + fetchSubmodules = true; + }; + }); + }) + ]; + }) + ] + ); +} diff --git a/nix/configuration/roles/shadps4/files/config.toml b/nix/configuration/roles/shadps4/files/config.toml new file mode 100644 index 0000000..e421171 --- /dev/null +++ b/nix/configuration/roles/shadps4/files/config.toml @@ -0,0 +1,4 @@ +[GUI] +addonInstallDir = "/home/talexander/.local/share/shadPS4/addcont" +installDirs = ["/home/talexander/.local/share/shadPS4/games"] +installDirsEnabled = [true]