mirror of https://github.com/materusPL/Nixerus.git
polymc: add dependencies, add gamemode and mangohud to wrapper
This commit is contained in:
parent
14e31ce759
commit
95aaa85d36
|
@ -3,28 +3,42 @@
|
|||
, fetchFromGitHub
|
||||
, cmake
|
||||
, ninja
|
||||
, jdk8
|
||||
, jdk
|
||||
, jdk21
|
||||
, ghc_filesystem
|
||||
, zlib
|
||||
, file
|
||||
, wrapQtAppsHook
|
||||
, xorg
|
||||
, libpulseaudio
|
||||
, openal
|
||||
, qtbase
|
||||
, qtwayland
|
||||
, qtsvg
|
||||
, glfw
|
||||
, pciutils
|
||||
, udev
|
||||
, glxinfo
|
||||
, quazip
|
||||
, libGL
|
||||
, msaClientID ? ""
|
||||
, flite
|
||||
, addOpenGLRunpath
|
||||
, vulkan-loader
|
||||
, msaClientID ? null
|
||||
, extra-cmake-modules
|
||||
, qtcharts
|
||||
# For wrapper
|
||||
, makeWrapper
|
||||
, gamemode
|
||||
, mangohud
|
||||
, glfw-wayland-minecraft
|
||||
, writeShellScript
|
||||
}:
|
||||
|
||||
|
||||
|
||||
let polymc =
|
||||
let
|
||||
polymc =
|
||||
let
|
||||
binpath = lib.makeBinPath ([ xorg.xrandr glxinfo pciutils ]);
|
||||
|
||||
libpath = with xorg; lib.makeLibraryPath ([
|
||||
libX11
|
||||
|
@ -34,15 +48,20 @@ let
|
|||
libXxf86vm
|
||||
libpulseaudio
|
||||
libGL
|
||||
vulkan-loader
|
||||
glfw
|
||||
openal
|
||||
udev
|
||||
flite
|
||||
stdenv.cc.cc.lib
|
||||
]);
|
||||
|
||||
|
||||
gameLibraryPath = libpath + ":/run/opengl-driver/lib";
|
||||
gameLibraryPath = libpath + ":${addOpenGLRunpath.driverLink}/lib";
|
||||
|
||||
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "polymc";
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "polymc" + (lib.optionalString ((lib.versions.major qtbase.version) == "5") "-qt5");
|
||||
version = "6.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
|
@ -53,28 +72,44 @@ stdenv.mkDerivation rec {
|
|||
fetchSubmodules = true;
|
||||
};
|
||||
dontWrapQtApps = true;
|
||||
nativeBuildInputs = [ cmake extra-cmake-modules ninja jdk ghc_filesystem file wrapQtAppsHook ];
|
||||
buildInputs = [ qtbase quazip zlib qtcharts ];
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
extra-cmake-modules
|
||||
ninja
|
||||
jdk21
|
||||
wrapQtAppsHook
|
||||
file
|
||||
ghc_filesystem
|
||||
];
|
||||
buildInputs = [
|
||||
qtbase
|
||||
qtsvg
|
||||
qtcharts
|
||||
qtwayland
|
||||
quazip
|
||||
zlib
|
||||
];
|
||||
|
||||
|
||||
cmakeFlags = [
|
||||
"-GNinja"
|
||||
"-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qtbase.version}"
|
||||
] ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ];
|
||||
]
|
||||
++ lib.optionals (msaClientID != null) [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ];
|
||||
|
||||
|
||||
postPatch = ''
|
||||
# hardcode jdk paths
|
||||
substituteInPlace launcher/java/JavaUtils.cpp \
|
||||
--replace 'scanJavaDir("/usr/lib/jvm")' 'javas.append("${jdk}/lib/openjdk/bin/java")' \
|
||||
--replace 'scanJavaDir("/usr/lib32/jvm")' 'javas.append("${jdk8}/lib/openjdk/bin/java")' \
|
||||
--replace 'scanJavaDir("/usr/lib/jvm")' 'javas.append("${jdk21}/lib/openjdk/bin/java")'
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
||||
wrapQtApp $out/bin/polymc \
|
||||
--prefix LD_LIBRARY_PATH : "${gameLibraryPath}" \
|
||||
--prefix PATH : "${lib.makeBinPath ([ xorg.xrandr ]) }"
|
||||
--suffix LD_LIBRARY_PATH : "${gameLibraryPath}" \
|
||||
--suffix PATH : "${binpath}" \
|
||||
--set-default ALSOFT_DRIVERS "pulse"
|
||||
'';
|
||||
passthru = {
|
||||
|
||||
|
@ -83,10 +118,20 @@ stdenv.mkDerivation rec {
|
|||
{ extraJDKs ? [ ]
|
||||
, extraPaths ? [ ]
|
||||
, extraLibs ? [ ]
|
||||
, withWaylandGLFW ? false
|
||||
, withMangohud ? true
|
||||
, withGamemode ? true
|
||||
}: stdenv.mkDerivation rec {
|
||||
pname = "polymc-wrapped";
|
||||
pname = "${polymc.pname}-wrapped";
|
||||
version = polymc.version;
|
||||
libsPath = (lib.makeLibraryPath (extraLibs ++ lib.optional withGamemode gamemode.lib)) + lib.optionalString withMangohud "${mangohud + "/lib/mangohud"}";
|
||||
binsPath = lib.makeBinPath (extraPaths ++ lib.optional withMangohud mangohud);
|
||||
|
||||
waylandPreExec = writeShellScript "waylandGLFW" ''
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH"
|
||||
fi
|
||||
'';
|
||||
src = polymc;
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
phases = [ "installPhase" "fixupPhase" ];
|
||||
|
@ -99,9 +144,10 @@ stdenv.mkDerivation rec {
|
|||
postFixup = let javaPaths = lib.makeSearchPath "bin/java" (extraJDKs); in
|
||||
''
|
||||
wrapProgram $out/bin/polymc \
|
||||
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath extraLibs}" \
|
||||
--prefix POLYMC_JAVA_PATHS : "${javaPaths}" \
|
||||
--prefix PATH : "${lib.makeBinPath extraPaths}"
|
||||
--suffix LD_LIBRARY_PATH : "${libsPath}" \
|
||||
--suffix POLYMC_JAVA_PATHS : "${javaPaths}" \
|
||||
--suffix PATH : "${binsPath}" ${lib.optionalString withWaylandGLFW ''--run ${waylandPreExec}''}
|
||||
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
@ -122,6 +168,6 @@ stdenv.mkDerivation rec {
|
|||
platforms = [ "x86_64-linux" ];
|
||||
license = licenses.gpl3Only;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
polymc
|
||||
|
|
|
@ -22,6 +22,7 @@ rec {
|
|||
obs-amf = pkgs.qt6Packages.callPackage ./apps/obs { ffmpeg = ffmpeg6-amf-full; inherit libcef; };
|
||||
|
||||
polymc = pkgs.qt6Packages.callPackage ./apps/games/polymc { };
|
||||
polymc-qt5 = pkgs.libsForQt5.callPackage ./apps/games/polymc { };
|
||||
|
||||
alvr = pkgs.callPackage ./apps/games/alvr { };
|
||||
|
||||
|
|
Loading…
Reference in New Issue