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"; + } + ]; + }; + }; + }) + ] + ); +}