nixpkgs/pkgs/by-name/pc/pcsx2/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

153 lines
3.7 KiB
Nix
Raw Normal View History

2022-05-30 13:36:31 +01:00
{ cmake
, fetchFromGitHub
2022-05-30 13:36:31 +01:00
, lib
2023-10-02 11:04:22 +01:00
, llvmPackages_17
, callPackage
2023-06-08 20:30:19 +01:00
, cubeb
2022-05-30 13:36:31 +01:00
, curl
, extra-cmake-modules
, fetchpatch
2022-05-30 13:36:31 +01:00
, ffmpeg
, libaio
2022-05-30 13:36:31 +01:00
, libbacktrace
, libpcap
, libwebp
2022-05-30 13:36:31 +01:00
, libXrandr
, lz4
2023-10-02 11:04:22 +01:00
, makeWrapper
2021-01-17 02:30:45 +00:00
, pkg-config
2024-04-29 16:09:44 +01:00
, qt6
, SDL2
, soundtouch
2023-06-10 04:49:31 +01:00
, strip-nondeterminism
, vulkan-headers
, vulkan-loader
2021-12-07 19:46:56 +00:00
, wayland
2022-05-30 13:36:31 +01:00
, zip
, zstd
2020-01-08 11:32:45 +00:00
}:
2016-02-26 09:21:31 +00:00
2022-05-30 13:36:31 +01:00
let
shaderc-patched = callPackage ./shaderc-patched.nix { };
2022-05-30 13:36:31 +01: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";
rev = "b3a788e16ea12efac006cbbe1ece45b6b9b34326";
sha256 = "sha256-Uvpz2Gpj533Sr6wLruubZxssoXefQDey8GHIDKWhW3s=";
2022-05-30 13:36:31 +01:00
};
2024-04-29 16:09:44 +01:00
inherit (qt6)
qtbase
qtsvg
qttools
qtwayland
wrapQtAppsHook
;
2022-05-30 13:36:31 +01:00
in
2024-04-29 16:09:44 +01:00
llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
pname = "pcsx2";
version = "1.7.5779";
2016-02-26 09:21:31 +00:00
src = fetchFromGitHub {
owner = "PCSX2";
repo = "pcsx2";
fetchSubmodules = true;
2024-04-29 16:09:44 +01:00
rev = "v${finalAttrs.version}";
sha256 = "sha256-WiwnP5yoBy8bRLUPuCZ7z4nhIzrY8P29KS5ZjErM/A4=";
2016-02-26 09:21:31 +00:00
};
patches = [
./define-rev.patch
# 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=";
})
];
2020-01-08 11:32:45 +00:00
cmakeFlags = [
(lib.cmakeBool "DISABLE_ADVANCE_SIMD" true)
(lib.cmakeBool "USE_LINKED_FFMPEG" true)
(lib.cmakeFeature "PCSX2_GIT_REV" finalAttrs.src.rev)
2020-01-08 11:32:45 +00:00
];
2016-02-26 09:21:31 +00:00
2023-06-10 06:21:40 +01:00
nativeBuildInputs = [
cmake
extra-cmake-modules
2023-06-10 06:21:40 +01:00
pkg-config
2023-06-10 04:49:31 +01:00
strip-nondeterminism
2023-06-10 06:21:40 +01:00
wrapQtAppsHook
zip
];
2016-02-26 09:21:31 +00:00
buildInputs = [
2022-05-30 13:36:31 +01:00
curl
ffmpeg
2020-01-08 11:32:45 +00:00
libaio
2022-05-30 13:36:31 +01:00
libbacktrace
2020-01-08 11:32:45 +00:00
libpcap
libwebp
2022-05-30 13:36:31 +01:00
libXrandr
lz4
2022-05-30 13:36:31 +01:00
qtbase
qtsvg
qttools
qtwayland
2020-01-08 11:32:45 +00:00
SDL2
shaderc-patched
2020-01-08 11:32:45 +00:00
soundtouch
2022-05-30 13:36:31 +01:00
vulkan-headers
2021-12-07 19:46:56 +00:00
wayland
zstd
2023-06-08 20:30:19 +01:00
]
++ cubeb.passthru.backendLibs;
2016-02-26 09:21:31 +00:00
2022-05-30 13:36:31 +01: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
2022-05-30 13:36:31 +01:00
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/*
2023-06-10 04:49:31 +01:00
strip-nondeterminism $out/bin/resources/patches.zip
'';
2023-10-02 11:04:22 +01: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'
'';
2022-05-30 13:36:31 +01:00
meta = with lib; {
2016-02-26 09:21:31 +00:00
description = "Playstation 2 emulator";
2021-12-07 19:44:45 +00:00
longDescription = ''
2016-02-26 09:21:31 +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.
'';
2020-01-08 11:32:45 +00:00
homepage = "https://pcsx2.net";
license = with licenses; [ gpl3Plus lgpl3Plus ];
maintainers = with maintainers; [ hrdinka govanify ];
2022-05-30 13:36:31 +01:00
mainProgram = "pcsx2-qt";
platforms = [ "x86_64-linux" ];
2016-02-26 09:21:31 +00:00
};
2024-04-29 16:09:44 +01:00
})