155 lines
4.1 KiB
Nix
155 lines
4.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
rpcs3_config_yaml = settingsFormat.generate "config.yml" config.me.rpcs3.config;
|
|
settingsFormat = pkgs.formats.yaml { };
|
|
in
|
|
{
|
|
imports = [ ];
|
|
|
|
options.me = {
|
|
rpcs3.enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
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" = lib.mkIf (config.me.optimizations.enable) config.me.optimizations.arch;
|
|
};
|
|
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 (
|
|
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";
|
|
}
|
|
];
|
|
|
|
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;
|
|
};
|
|
};
|
|
|
|
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";
|
|
}
|
|
{
|
|
# Controller config.
|
|
directory = ".config/rpcs3/input_configs";
|
|
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";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
})
|
|
]
|
|
);
|
|
}
|