Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / prismlauncher / wrapper.nix
blob4b0aa418fb6a31b4fde8700b440be27528164db5
1 { lib
2 , stdenv
3 , symlinkJoin
4 , prismlauncher-unwrapped
5 , wrapQtAppsHook
6 , addOpenGLRunpath
7 , qtbase  # needed for wrapQtAppsHook
8 , qtsvg
9 , qtwayland
10 , xorg
11 , libpulseaudio
12 , libGL
13 , glfw
14 , openal
15 , jdk8
16 , jdk17
17 , gamemode
18 , flite
19 , mesa-demos
20 , udev
21 , libusb1
23 , msaClientID ? null
24 , gamemodeSupport ? stdenv.isLinux
25 , textToSpeechSupport ? stdenv.isLinux
26 , controllerSupport ? stdenv.isLinux
27 , jdks ? [ jdk17 jdk8 ]
28 , additionalLibs ? [ ]
29 , additionalPrograms ? [ ]
31 let
32   prismlauncherFinal = prismlauncher-unwrapped.override {
33     inherit msaClientID gamemodeSupport;
34   };
36 symlinkJoin {
37   name = "prismlauncher-${prismlauncherFinal.version}";
39   paths = [ prismlauncherFinal ];
41   nativeBuildInputs = [
42     wrapQtAppsHook
43   ];
45   buildInputs = [
46     qtbase
47     qtsvg
48   ]
49   ++ lib.optional (lib.versionAtLeast qtbase.version "6" && stdenv.isLinux) qtwayland;
51   postBuild = ''
52     wrapQtAppsHook
53   '';
55   qtWrapperArgs =
56     let
57       runtimeLibs = (with xorg; [
58         libX11
59         libXext
60         libXcursor
61         libXrandr
62         libXxf86vm
63       ])
64       ++ [
65         # lwjgl
66         libpulseaudio
67         libGL
68         glfw
69         openal
70         stdenv.cc.cc.lib
72         # oshi
73         udev
74       ]
75       ++ lib.optional gamemodeSupport gamemode.lib
76       ++ lib.optional textToSpeechSupport flite
77       ++ lib.optional controllerSupport libusb1
78       ++ additionalLibs;
80       runtimePrograms = [
81         xorg.xrandr
82         mesa-demos # need glxinfo
83       ]
84       ++ additionalPrograms;
86     in
87     [ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
88     ++ lib.optionals stdenv.isLinux [
89       "--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
90       # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
91       "--prefix PATH : ${lib.makeBinPath runtimePrograms}"
92     ];
94   inherit (prismlauncherFinal) meta;