home-assistant: support lightify component (#379007)
[NixPkgs.git] / pkgs / by-name / rp / rpcs3 / package.nix
blob07b0de1f79339aa2e6c4f01e7c4cf7ddc3b5efa5
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   pkg-config,
7   git,
8   qt6Packages,
9   openal,
10   glew,
11   vulkan-headers,
12   vulkan-loader,
13   libpng,
14   libSM,
15   ffmpeg,
16   libevdev,
17   libusb1,
18   zlib,
19   curl,
20   wolfssl,
21   python3,
22   pugixml,
23   flatbuffers,
24   llvm_16,
25   cubeb,
26   enableDiscordRpc ? false,
27   faudioSupport ? true,
28   faudio,
29   SDL2,
30   waylandSupport ? true,
31   wayland,
32   wrapGAppsHook3,
35 let
36   # Keep these separate so the update script can regex them
37   rpcs3GitVersion = "17265-418a99a62";
38   rpcs3Version = "0.0.34-17265-418a99a62";
39   rpcs3Revision = "418a99a62b814b7f831072610c9e7d7b5e90610c";
40   rpcs3Hash = "sha256-NN7gEtt/18JCAHFZNQ8OqpATWx50qXda2Kk7NVq5T9Y=";
42   inherit (qt6Packages)
43     qtbase
44     qtmultimedia
45     wrapQtAppsHook
46     qtwayland
47     ;
49 stdenv.mkDerivation {
50   pname = "rpcs3";
51   version = rpcs3Version;
53   src = fetchFromGitHub {
54     owner = "RPCS3";
55     repo = "rpcs3";
56     rev = rpcs3Revision;
57     fetchSubmodules = true;
58     hash = rpcs3Hash;
59   };
61   passthru.updateScript = ./update.sh;
63   preConfigure = ''
64     cat > ./rpcs3/git-version.h <<EOF
65     #define RPCS3_GIT_VERSION "${rpcs3GitVersion}"
66     #define RPCS3_GIT_FULL_BRANCH "RPCS3/rpcs3/master"
67     #define RPCS3_GIT_BRANCH "HEAD"
68     #define RPCS3_GIT_VERSION_NO_UPDATE 1
69     EOF
70   '';
72   cmakeFlags = [
73     (lib.cmakeBool "USE_SYSTEM_ZLIB" true)
74     (lib.cmakeBool "USE_SYSTEM_LIBUSB" true)
75     (lib.cmakeBool "USE_SYSTEM_LIBPNG" true)
76     (lib.cmakeBool "USE_SYSTEM_FFMPEG" true)
77     (lib.cmakeBool "USE_SYSTEM_CURL" true)
78     (lib.cmakeBool "USE_SYSTEM_WOLFSSL" true)
79     (lib.cmakeBool "USE_SYSTEM_FAUDIO" true)
80     (lib.cmakeBool "USE_SYSTEM_PUGIXML" true)
81     (lib.cmakeBool "USE_SYSTEM_FLATBUFFERS" true)
82     (lib.cmakeBool "USE_SYSTEM_SDL" true)
83     (lib.cmakeBool "USE_SDL" true)
84     (lib.cmakeBool "WITH_LLVM" true)
85     (lib.cmakeBool "BUILD_LLVM" false)
86     (lib.cmakeBool "USE_NATIVE_INSTRUCTIONS" false)
87     (lib.cmakeBool "USE_DISCORD_RPC" enableDiscordRpc)
88     (lib.cmakeBool "USE_FAUDIO" faudioSupport)
89   ];
91   dontWrapGApps = true;
93   nativeBuildInputs = [
94     cmake
95     pkg-config
96     git
97     wrapQtAppsHook
98     wrapGAppsHook3
99   ];
101   buildInputs =
102     [
103       qtbase
104       qtmultimedia
105       openal
106       glew
107       vulkan-headers
108       vulkan-loader
109       libpng
110       ffmpeg
111       libevdev
112       zlib
113       libusb1
114       curl
115       wolfssl
116       python3
117       pugixml
118       SDL2
119       flatbuffers
120       llvm_16
121       libSM
122     ]
123     ++ cubeb.passthru.backendLibs
124     ++ lib.optional faudioSupport faudio
125     ++ lib.optionals waylandSupport [
126       wayland
127       qtwayland
128     ];
130   preFixup = ''
131     qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
132   '';
134   postInstall = ''
135     # Taken from https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration
136     install -D ${./99-ds3-controllers.rules} $out/etc/udev/rules.d/99-ds3-controllers.rules
137     install -D ${./99-ds4-controllers.rules} $out/etc/udev/rules.d/99-ds4-controllers.rules
138     install -D ${./99-dualsense-controllers.rules} $out/etc/udev/rules.d/99-dualsense-controllers.rules
139   '';
141   meta = with lib; {
142     description = "PS3 emulator/debugger";
143     homepage = "https://rpcs3.net/";
144     maintainers = with maintainers; [
145       abbradar
146       neonfuz
147       ilian
148       zane
149     ];
150     license = licenses.gpl2Only;
151     platforms = [
152       "x86_64-linux"
153       "aarch64-linux"
154     ];
155     mainProgram = "rpcs3";
156   };