2025-03-22 13:39:13 -04:00

95 lines
2.5 KiB
Nix

# MANUAL: mkdir -p ~/.persist/.config/PCSX2/memcards ~/.state/.config/PCSX2/cache ~/.state/.config/PCSX2/sstates ~/.state/.config/PCSX2/snaps ~/.state/.config/PCSX2/covers ~/.state/.config/PCSX2/videos
{
config,
lib,
pkgs,
...
}:
let
steam_pcsx2 = pkgs.writeScriptBin "steam_pcsx2" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs.pcsx2}/bin/pcsx2-qt
'';
in
{
imports = [ ];
options.me = {
pcsx2.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install pcsx2.";
};
};
config = lib.mkIf config.me.pcsx2.enable (
lib.mkMerge [
(lib.mkIf config.me.graphical {
home.packages = with pkgs; [
pcsx2
steam_pcsx2
];
home.file.".config/PCSX2/inis/PCSX2.ini" = {
source = ./files/PCSX2.ini;
};
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".config/PCSX2/memcards";
method = "symlink";
}
];
};
home.persistence."/home/deck/.state" = {
directories = [
{
directory = ".config/PCSX2/cache";
method = "symlink";
}
{
directory = ".config/PCSX2/sstates";
method = "symlink";
}
{
directory = ".config/PCSX2/snaps";
method = "symlink";
}
{
directory = ".config/PCSX2/covers";
method = "symlink";
}
{
directory = ".config/PCSX2/videos";
method = "symlink";
}
];
};
nixpkgs.overlays = [
(final: prev: {
pcsx2 = pkgs.buildEnv {
name = prev.pcsx2.name;
paths = [
(config.lib.nixGL.wrap prev.pcsx2)
];
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
'';
};
})
];
})
]
);
}