diff --git a/pkgs/games/prismlauncher/default.nix b/pkgs/games/prismlauncher/default.nix index 2409794cdfdcb..a100d0540b0df 100644 --- a/pkgs/games/prismlauncher/default.nix +++ b/pkgs/games/prismlauncher/default.nix @@ -31,13 +31,13 @@ assert lib.assertMsg (stdenv.isLinux || !gamemodeSupport) "gamemodeSupport is on stdenv.mkDerivation (finalAttrs: { pname = "prismlauncher-unwrapped"; - version = "8.0"; + version = "8.3"; src = fetchFromGitHub { owner = "PrismLauncher"; repo = "PrismLauncher"; rev = finalAttrs.version; - hash = "sha256-WBajtfj3qAMq8zd2S53CQyHiyqtvffLOHOjmOpdALAA="; + hash = "sha256-1YGzCgNdzscnOVeNlHMFJa0RbMo6C2qQjtBOeDxHakI="; }; nativeBuildInputs = [ extra-cmake-modules cmake jdk17 ninja canonicalize-jars-hook ]; @@ -60,7 +60,11 @@ stdenv.mkDerivation (finalAttrs: { "-DLauncher_BUILD_PLATFORM=nixpkgs" ] ++ lib.optionals (msaClientID != null) [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] ++ lib.optionals (lib.versionOlder qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=5" ] - ++ lib.optionals stdenv.isDarwin [ "-DINSTALL_BUNDLE=nodeps" "-DMACOSX_SPARKLE_UPDATE_FEED_URL=''" ]; + ++ lib.optionals stdenv.isDarwin [ + "-DINSTALL_BUNDLE=nodeps" + "-DMACOSX_SPARKLE_UPDATE_FEED_URL=''" + "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/Applications/" + ]; postUnpack = '' rm -rf source/libraries/libnbtplusplus @@ -69,7 +73,7 @@ stdenv.mkDerivation (finalAttrs: { dontWrapQtApps = true; - meta = with lib; { + meta = { mainProgram = "prismlauncher"; homepage = "https://prismlauncher.org/"; description = "A free, open source launcher for Minecraft"; @@ -78,9 +82,9 @@ stdenv.mkDerivation (finalAttrs: { their own mods, texture packs, saves, etc) and helps you manage them and their associated options with a simple interface. ''; - platforms = with platforms; linux ++ darwin; - changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${version}"; - license = licenses.gpl3Only; - maintainers = with maintainers; [ minion3665 Scrumplex getchoo ]; + platforms = with lib.platforms; linux ++ darwin; + changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${finalAttrs.version}"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ minion3665 Scrumplex getchoo ]; }; }) diff --git a/pkgs/games/prismlauncher/wrapper.nix b/pkgs/games/prismlauncher/wrapper.nix index 316bbbb122070..3393ff45efdcb 100644 --- a/pkgs/games/prismlauncher/wrapper.nix +++ b/pkgs/games/prismlauncher/wrapper.nix @@ -1,9 +1,12 @@ { lib , stdenv , symlinkJoin -, prismlauncher-unwrapped +, makeWrapper , wrapQtAppsHook , addOpenGLRunpath + +, prismlauncher-unwrapped + , qtbase # needed for wrapQtAppsHook , qtsvg , qtwayland @@ -11,37 +14,57 @@ , libpulseaudio , libGL , glfw +, glfw-wayland-minecraft , openal , jdk8 , jdk17 +, jdk21 , gamemode , flite , mesa-demos , pciutils , udev +, vulkan-loader , libusb1 , msaClientID ? null , gamemodeSupport ? stdenv.isLinux , textToSpeechSupport ? stdenv.isLinux , controllerSupport ? stdenv.isLinux -, jdks ? [ jdk17 jdk8 ] + + # Adds `glfw-wayland-minecraft` to `LD_LIBRARY_PATH` + # when launched on wayland, allowing for the game to be run natively. + # Make sure to enable "Use system installation of GLFW" in instance settings + # for this to take effect + # + # Warning: This build of glfw may be unstable, and the launcher + # itself can take slightly longer to start +, withWaylandGLFW ? false + +, jdks ? [ jdk21 jdk17 jdk8 ] , additionalLibs ? [ ] , additionalPrograms ? [ ] }: + +assert lib.assertMsg (withWaylandGLFW -> stdenv.isLinux) "withWaylandGLFW is only available on Linux"; + let - prismlauncherFinal = prismlauncher-unwrapped.override { + prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; }; in + symlinkJoin { - name = "prismlauncher-${prismlauncherFinal.version}"; + name = "prismlauncher-${prismlauncher'.version}"; - paths = [ prismlauncherFinal ]; + paths = [ prismlauncher' ]; nativeBuildInputs = [ wrapQtAppsHook - ]; + ] + # purposefully using a shell wrapper here for variable expansion + # see https://github.com/NixOS/nixpkgs/issues/172583 + ++ lib.optional withWaylandGLFW makeWrapper; buildInputs = [ qtbase @@ -49,26 +72,36 @@ symlinkJoin { ] ++ lib.optional (lib.versionAtLeast qtbase.version "6" && stdenv.isLinux) qtwayland; + waylandPreExec = lib.optionalString withWaylandGLFW '' + if [ -n "$WAYLAND_DISPLAY" ]; then + export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH" + fi + ''; + postBuild = '' + ${lib.optionalString withWaylandGLFW '' + qtWrapperArgs+=(--run "$waylandPreExec") + ''} + wrapQtAppsHook ''; qtWrapperArgs = let - runtimeLibs = (with xorg; [ - libX11 - libXext - libXcursor - libXrandr - libXxf86vm - ]) - ++ [ + runtimeLibs = [ + xorg.libX11 + xorg.libXext + xorg.libXcursor + xorg.libXrandr + xorg.libXxf86vm + # lwjgl libpulseaudio libGL glfw openal stdenv.cc.cc.lib + vulkan-loader # VulkanMod's lwjgl # oshi udev @@ -93,5 +126,5 @@ symlinkJoin { "--prefix PATH : ${lib.makeBinPath runtimePrograms}" ]; - inherit (prismlauncherFinal) meta; + inherit (prismlauncher') meta; }