2023-07-15 17:15:38 +00:00
|
|
|
{ cmake
|
2020-11-19 00:13:47 +00:00
|
|
|
, fetchFromGitHub
|
2023-07-15 17:15:38 +00:00
|
|
|
, lib
|
2024-01-02 11:29:13 +00:00
|
|
|
, llvmPackages_17
|
2024-06-20 14:57:18 +00:00
|
|
|
, callPackage
|
2023-07-15 17:15:38 +00:00
|
|
|
, cubeb
|
|
|
|
, curl
|
2023-10-09 19:29:22 +00:00
|
|
|
, extra-cmake-modules
|
2024-06-20 14:57:18 +00:00
|
|
|
, fetchpatch
|
2023-07-15 17:15:38 +00:00
|
|
|
, ffmpeg
|
2020-11-19 00:13:47 +00:00
|
|
|
, libaio
|
2023-07-15 17:15:38 +00:00
|
|
|
, libbacktrace
|
2020-11-19 00:13:47 +00:00
|
|
|
, libpcap
|
2024-01-25 14:12:00 +00:00
|
|
|
, libwebp
|
2023-07-15 17:15:38 +00:00
|
|
|
, libXrandr
|
2024-01-25 14:12:00 +00:00
|
|
|
, lz4
|
2024-01-02 11:29:13 +00:00
|
|
|
, makeWrapper
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2024-06-20 14:57:18 +00:00
|
|
|
, qt6
|
2020-11-19 00:13:47 +00:00
|
|
|
, SDL2
|
|
|
|
, soundtouch
|
2023-07-15 17:15:38 +00:00
|
|
|
, strip-nondeterminism
|
2022-05-18 14:49:53 +00:00
|
|
|
, vulkan-headers
|
|
|
|
, vulkan-loader
|
2021-12-19 01:06:50 +00:00
|
|
|
, wayland
|
2023-07-15 17:15:38 +00:00
|
|
|
, zip
|
2024-01-25 14:12:00 +00:00
|
|
|
, zstd
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
let
|
2024-06-20 14:57:18 +00:00
|
|
|
shaderc-patched = callPackage ./shaderc-patched.nix { };
|
2023-07-15 17:15:38 +00:00
|
|
|
# The pre-zipped files in releases don't have a versioned link, we need to zip them ourselves
|
|
|
|
pcsx2_patches = fetchFromGitHub {
|
|
|
|
owner = "PCSX2";
|
|
|
|
repo = "pcsx2_patches";
|
2024-06-20 14:57:18 +00:00
|
|
|
rev = "b3a788e16ea12efac006cbbe1ece45b6b9b34326";
|
|
|
|
sha256 = "sha256-Uvpz2Gpj533Sr6wLruubZxssoXefQDey8GHIDKWhW3s=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
2024-06-20 14:57:18 +00:00
|
|
|
inherit (qt6)
|
|
|
|
qtbase
|
|
|
|
qtsvg
|
|
|
|
qttools
|
|
|
|
qtwayland
|
|
|
|
wrapQtAppsHook
|
|
|
|
;
|
2023-07-15 17:15:38 +00:00
|
|
|
in
|
2024-06-20 14:57:18 +00:00
|
|
|
llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "pcsx2";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "1.7.5779";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "PCSX2";
|
|
|
|
repo = "pcsx2";
|
2020-11-19 00:13:47 +00:00
|
|
|
fetchSubmodules = true;
|
2024-06-20 14:57:18 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
|
|
|
sha256 = "sha256-WiwnP5yoBy8bRLUPuCZ7z4nhIzrY8P29KS5ZjErM/A4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
patches = [
|
|
|
|
./define-rev.patch
|
2024-06-20 14:57:18 +00:00
|
|
|
# Backport patches to fix random crashes on startup
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/PCSX2/pcsx2/commit/e47bcf8d80df9a93201eefbaf169ec1a0673a833.patch";
|
|
|
|
sha256 = "sha256-7CL1Kpu+/JgtKIenn9rQKAs3A+oJ40W5XHlqSg77Q7Y=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/PCSX2/pcsx2/commit/92b707db994f821bccc35d6eef67727ea3ab496b.patch";
|
|
|
|
sha256 = "sha256-HWJ8KZAY/qBBotAJerZg6zi5QUHuTD51zKH1rAtZ3tc=";
|
|
|
|
})
|
2024-01-25 14:12:00 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cmakeFlags = [
|
2024-06-20 14:57:18 +00:00
|
|
|
(lib.cmakeBool "DISABLE_ADVANCE_SIMD" true)
|
|
|
|
(lib.cmakeBool "USE_LINKED_FFMPEG" true)
|
|
|
|
(lib.cmakeFeature "PCSX2_GIT_REV" finalAttrs.src.rev)
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2023-10-09 19:29:22 +00:00
|
|
|
extra-cmake-modules
|
2023-07-15 17:15:38 +00:00
|
|
|
pkg-config
|
|
|
|
strip-nondeterminism
|
|
|
|
wrapQtAppsHook
|
|
|
|
zip
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2023-07-15 17:15:38 +00:00
|
|
|
curl
|
|
|
|
ffmpeg
|
2020-04-24 23:36:52 +00:00
|
|
|
libaio
|
2023-07-15 17:15:38 +00:00
|
|
|
libbacktrace
|
2020-04-24 23:36:52 +00:00
|
|
|
libpcap
|
2024-01-25 14:12:00 +00:00
|
|
|
libwebp
|
2023-07-15 17:15:38 +00:00
|
|
|
libXrandr
|
2024-01-25 14:12:00 +00:00
|
|
|
lz4
|
2023-07-15 17:15:38 +00:00
|
|
|
qtbase
|
|
|
|
qtsvg
|
|
|
|
qttools
|
|
|
|
qtwayland
|
2020-04-24 23:36:52 +00:00
|
|
|
SDL2
|
2024-06-20 14:57:18 +00:00
|
|
|
shaderc-patched
|
2020-04-24 23:36:52 +00:00
|
|
|
soundtouch
|
2023-07-15 17:15:38 +00:00
|
|
|
vulkan-headers
|
2021-12-19 01:06:50 +00:00
|
|
|
wayland
|
2024-01-25 14:12:00 +00:00
|
|
|
zstd
|
2023-07-15 17:15:38 +00:00
|
|
|
]
|
|
|
|
++ cubeb.passthru.backendLibs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp -a bin/pcsx2-qt bin/resources $out/bin/
|
|
|
|
|
|
|
|
install -Dm644 $src/pcsx2-qt/resources/icons/AppIcon64.png $out/share/pixmaps/PCSX2.png
|
|
|
|
install -Dm644 $src/.github/workflows/scripts/linux/pcsx2-qt.desktop $out/share/applications/PCSX2.desktop
|
|
|
|
|
|
|
|
zip -jq $out/bin/resources/patches.zip ${pcsx2_patches}/patches/*
|
|
|
|
strip-nondeterminism $out/bin/resources/patches.zip
|
2022-05-18 14:49:53 +00:00
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
qtWrapperArgs =
|
|
|
|
let
|
|
|
|
libs = lib.makeLibraryPath ([
|
|
|
|
vulkan-loader
|
|
|
|
] ++ cubeb.passthru.backendLibs);
|
|
|
|
in [
|
|
|
|
"--prefix LD_LIBRARY_PATH : ${libs}"
|
|
|
|
];
|
|
|
|
|
|
|
|
# https://github.com/PCSX2/pcsx2/pull/10200
|
|
|
|
# Can't avoid the double wrapping, the binary wrapper from qtWrapperArgs doesn't support --run
|
|
|
|
postFixup = ''
|
|
|
|
source "${makeWrapper}/nix-support/setup-hook"
|
|
|
|
wrapProgram $out/bin/pcsx2-qt \
|
|
|
|
--run 'if [[ -z $I_WANT_A_BROKEN_WAYLAND_UI ]]; then export QT_QPA_PLATFORM=xcb; fi'
|
|
|
|
'';
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Playstation 2 emulator";
|
2021-12-19 01:06:50 +00:00
|
|
|
longDescription = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
PCSX2 is an open-source PlayStation 2 (AKA PS2) emulator. Its purpose
|
|
|
|
is to emulate the PS2 hardware, using a combination of MIPS CPU
|
|
|
|
Interpreters, Recompilers and a Virtual Machine which manages hardware
|
|
|
|
states and PS2 system memory. This allows you to play PS2 games on your
|
|
|
|
PC, with many additional features and benefits.
|
|
|
|
'';
|
|
|
|
homepage = "https://pcsx2.net";
|
2024-06-20 14:57:18 +00:00
|
|
|
license = with licenses; [ gpl3Plus lgpl3Plus ];
|
2021-04-05 15:23:46 +00:00
|
|
|
maintainers = with maintainers; [ hrdinka govanify ];
|
2023-07-15 17:15:38 +00:00
|
|
|
mainProgram = "pcsx2-qt";
|
2024-06-20 14:57:18 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-06-20 14:57:18 +00:00
|
|
|
})
|