nixpkgs/pkgs/games/prismlauncher/wrapper.nix

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

98 lines
1.9 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, symlinkJoin
, prismlauncher-unwrapped
, wrapQtAppsHook
, addOpenGLRunpath
, qtbase # needed for wrapQtAppsHook
, qtsvg
, qtwayland
, xorg
, libpulseaudio
, libGL
, glfw
, openal
, jdk8
, jdk17
, gamemode
, flite
, mesa-demos
, pciutils
, udev
, libusb1
, msaClientID ? null
2023-07-21 02:21:57 +02:00
, gamemodeSupport ? stdenv.isLinux
, textToSpeechSupport ? stdenv.isLinux
, controllerSupport ? stdenv.isLinux
, jdks ? [ jdk17 jdk8 ]
, additionalLibs ? [ ]
, additionalPrograms ? [ ]
}:
let
prismlauncherFinal = prismlauncher-unwrapped.override {
inherit msaClientID gamemodeSupport;
};
in
symlinkJoin {
name = "prismlauncher-${prismlauncherFinal.version}";
paths = [ prismlauncherFinal ];
nativeBuildInputs = [
wrapQtAppsHook
];
buildInputs = [
qtbase
qtsvg
]
2023-07-21 02:21:57 +02:00
++ lib.optional (lib.versionAtLeast qtbase.version "6" && stdenv.isLinux) qtwayland;
postBuild = ''
wrapQtAppsHook
'';
qtWrapperArgs =
let
runtimeLibs = (with xorg; [
libX11
libXext
libXcursor
libXrandr
libXxf86vm
])
++ [
# lwjgl
libpulseaudio
libGL
glfw
openal
stdenv.cc.cc.lib
# oshi
udev
]
++ lib.optional gamemodeSupport gamemode.lib
++ lib.optional textToSpeechSupport flite
++ lib.optional controllerSupport libusb1
++ additionalLibs;
runtimePrograms = [
xorg.xrandr
mesa-demos # need glxinfo
pciutils # need lspci
]
++ additionalPrograms;
in
2023-07-21 02:21:57 +02:00
[ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ]
++ lib.optionals stdenv.isLinux [
"--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}"
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
"--prefix PATH : ${lib.makeBinPath runtimePrograms}"
];
inherit (prismlauncherFinal) meta;
}