1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
{
lib,
SDL2,
callPackage,
cmake,
cubeb,
curl,
extra-cmake-modules,
fetchFromGitHub,
ffmpeg,
libXrandr,
libaio,
libbacktrace,
libpcap,
libwebp,
llvmPackages_17,
lz4,
makeWrapper,
pkg-config,
qt6,
soundtouch,
strip-nondeterminism,
vulkan-headers,
vulkan-loader,
wayland,
zip,
zstd,
}:
let
sources = callPackage ./sources.nix { };
inherit (qt6)
qtbase
qtsvg
qttools
qtwayland
wrapQtAppsHook
;
in
llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
inherit (sources.pcsx2) pname version src;
patches = [
# Remove PCSX2_GIT_REV
./0000-define-rev.patch
];
cmakeFlags = [
(lib.cmakeBool "DISABLE_ADVANCE_SIMD" true)
(lib.cmakeBool "USE_LINKED_FFMPEG" true)
(lib.cmakeFeature "PCSX2_GIT_REV" finalAttrs.src.rev)
];
nativeBuildInputs = [
cmake
pkg-config
strip-nondeterminism
wrapQtAppsHook
zip
];
buildInputs = [
curl
extra-cmake-modules
ffmpeg
libaio
libbacktrace
libpcap
libwebp
libXrandr
lz4
qtbase
qtsvg
qttools
qtwayland
SDL2
sources.shaderc-patched
soundtouch
vulkan-headers
wayland
zstd
] ++ cubeb.passthru.backendLibs;
strictDeps = true;
installPhase = ''
runHook preInstall
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 ${sources.pcsx2_patches.src}/patches/*
strip-nondeterminism $out/bin/resources/patches.zip
runHook postInstall
'';
qtWrapperArgs =
let
libs = lib.makeLibraryPath (
[
vulkan-loader
sources.shaderc-patched
]
++ 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'
'';
meta = {
homepage = "https://pcsx2.net";
description = "Playstation 2 emulator";
longDescription = ''
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.
'';
changelog = "https://github.com/PCSX2/pcsx2/releases/tag/v${finalAttrs.version}";
downloadPage = "https://github.com/PCSX2/pcsx2";
license = with lib.licenses; [
gpl3Plus
lgpl3Plus
];
mainProgram = "pcsx2-qt";
maintainers = with lib.maintainers; [
AndersonTorres
hrdinka
govanify
matteopacini
];
platforms = lib.systems.inspect.patternLogicalAnd
lib.systems.inspect.patterns.isLinux
lib.systems.inspect.patterns.isx86_64;
};
})
|