113 lines
3.1 KiB
Nix
113 lines
3.1 KiB
Nix
# 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:
|
|
let
|
|
optimizeWithFlags =
|
|
pkg: flags:
|
|
pkg.overrideAttrs (old: {
|
|
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
|
|
});
|
|
original_package =
|
|
if config.me.optimizations.enable then
|
|
(optimizeWithFlags prev.rpcs3 [
|
|
"-march=znver2"
|
|
"-mtune=znver2"
|
|
])
|
|
else
|
|
prev.rpcs3;
|
|
in
|
|
{
|
|
rpcs3 = pkgs.buildEnv {
|
|
name = prev.rpcs3.name;
|
|
paths = [
|
|
(config.lib.nixGL.wrap original_package)
|
|
];
|
|
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/rpcs3.desktop
|
|
'';
|
|
};
|
|
}
|
|
)
|
|
];
|
|
})
|
|
]
|
|
);
|
|
}
|