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