From 02e90f12452e94f5529f13af49ecae72d0cd8b39 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Sun, 31 Dec 2023 18:31:19 +0100 Subject: [PATCH 1/8] prismlauncher: fix meta using lib.version instead of finalAttrs.version --- pkgs/games/prismlauncher/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/games/prismlauncher/default.nix b/pkgs/games/prismlauncher/default.nix index 2409794cdfdcb..c6378fbc368f9 100644 --- a/pkgs/games/prismlauncher/default.nix +++ b/pkgs/games/prismlauncher/default.nix @@ -69,7 +69,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 +78,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 ]; }; }) From f3b36f14e7b1afb2f03d2bfef31c890ba3d326f0 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:21:12 +0100 Subject: [PATCH 2/8] Merge pull request #259122 from spikespaz/prismlauncher-glfw-wayland prismlauncher: add withWaylandGLFW override --- pkgs/games/prismlauncher/wrapper.nix | 61 +++++++++++++++++++++------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/pkgs/games/prismlauncher/wrapper.nix b/pkgs/games/prismlauncher/wrapper.nix index 316bbbb122070..9f9913e67f84d 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,6 +14,7 @@ , libpulseaudio , libGL , glfw +, glfw-wayland-minecraft , openal , jdk8 , jdk17 @@ -25,23 +29,43 @@ , gamemodeSupport ? stdenv.isLinux , textToSpeechSupport ? stdenv.isLinux , controllerSupport ? stdenv.isLinux + +# The flag `withWaylandGLFW` enables runtime-checking of `WAYLAND_DISPLAY`; +# if the option is enabled, a patched version of GLFW will be added to +# `LD_LIBRARY_PATH` so that the launcher can use the correct one +# depending on the desktop environment used. +, withWaylandGLFW ? false + , jdks ? [ jdk17 jdk8 ] , additionalLibs ? [ ] , additionalPrograms ? [ ] }: + +assert lib.assertMsg (withWaylandGLFW -> stdenv.isLinux) "withWaylandGLFW is only available on Linux"; + let - prismlauncherFinal = prismlauncher-unwrapped.override { + # By default, this package uses a binary wrapper for `wrapQtAppsHook`. + # Enabling `shellWrapper` will add `makeWrapper` to `nativeBuildInputs`, + # causing `wrapQtAppsHook` to output a shell wrapper instead. + # This is needed for checking environment variables at runtime + # and modifying others if necessary (see above option for example). + # Warning: This can make the program start slower, by about four milliseconds. + shellWrapper = withWaylandGLFW; + + prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; }; in + symlinkJoin { - name = "prismlauncher-${prismlauncherFinal.version}"; + name = "prismlauncher-${prismlauncher'.version}"; - paths = [ prismlauncherFinal ]; + paths = [ prismlauncher' ]; nativeBuildInputs = [ wrapQtAppsHook - ]; + ] + ++ lib.optional shellWrapper makeWrapper; buildInputs = [ qtbase @@ -49,20 +73,29 @@ symlinkJoin { ] ++ lib.optional (lib.versionAtLeast qtbase.version "6" && stdenv.isLinux) qtwayland; + waylandPreExec = '' + 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 @@ -93,5 +126,5 @@ symlinkJoin { "--prefix PATH : ${lib.makeBinPath runtimePrograms}" ]; - inherit (prismlauncherFinal) meta; + inherit (prismlauncher') meta; } From f794b410a3382f63e1e4d44b5a9212017dd84d36 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 3 Jan 2024 15:59:39 -0500 Subject: [PATCH 3/8] prismlauncher: better document withWaylandGLFW --- pkgs/games/prismlauncher/wrapper.nix | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pkgs/games/prismlauncher/wrapper.nix b/pkgs/games/prismlauncher/wrapper.nix index 9f9913e67f84d..dafe7276af881 100644 --- a/pkgs/games/prismlauncher/wrapper.nix +++ b/pkgs/games/prismlauncher/wrapper.nix @@ -30,10 +30,13 @@ , textToSpeechSupport ? stdenv.isLinux , controllerSupport ? stdenv.isLinux -# The flag `withWaylandGLFW` enables runtime-checking of `WAYLAND_DISPLAY`; -# if the option is enabled, a patched version of GLFW will be added to -# `LD_LIBRARY_PATH` so that the launcher can use the correct one -# depending on the desktop environment used. + # 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 ? [ jdk17 jdk8 ] @@ -44,14 +47,6 @@ assert lib.assertMsg (withWaylandGLFW -> stdenv.isLinux) "withWaylandGLFW is only available on Linux"; let - # By default, this package uses a binary wrapper for `wrapQtAppsHook`. - # Enabling `shellWrapper` will add `makeWrapper` to `nativeBuildInputs`, - # causing `wrapQtAppsHook` to output a shell wrapper instead. - # This is needed for checking environment variables at runtime - # and modifying others if necessary (see above option for example). - # Warning: This can make the program start slower, by about four milliseconds. - shellWrapper = withWaylandGLFW; - prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; }; @@ -65,7 +60,9 @@ symlinkJoin { nativeBuildInputs = [ wrapQtAppsHook ] - ++ lib.optional shellWrapper makeWrapper; + # purposefully using a shell wrapper here for variable expansion + # see https://github.com/NixOS/nixpkgs/issues/172583 + ++ lib.optional withWaylandGLFW makeWrapper; buildInputs = [ qtbase From 762eebd3da77b0a5f4dd0c8014d76b10458886d4 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 3 Mar 2024 20:30:07 +0100 Subject: [PATCH 4/8] prismlauncher: 8.0 -> 8.2 Signed-off-by: Sefa Eyeoglu --- pkgs/games/prismlauncher/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/games/prismlauncher/default.nix b/pkgs/games/prismlauncher/default.nix index c6378fbc368f9..c4571ceaa71bd 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.2"; src = fetchFromGitHub { owner = "PrismLauncher"; repo = "PrismLauncher"; rev = finalAttrs.version; - hash = "sha256-WBajtfj3qAMq8zd2S53CQyHiyqtvffLOHOjmOpdALAA="; + hash = "sha256-4VsoxZzi/EfEsnDvvwzg2xhj7j5B+k3gvaSqwJFDweE="; }; nativeBuildInputs = [ extra-cmake-modules cmake jdk17 ninja canonicalize-jars-hook ]; From c9f15bd94a2898767fe1c520361deb612d96a03c Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Wed, 3 Apr 2024 18:15:12 +0200 Subject: [PATCH 5/8] prismlauncher: add jdk21 to wrapper Signed-off-by: Sefa Eyeoglu --- pkgs/games/prismlauncher/wrapper.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/games/prismlauncher/wrapper.nix b/pkgs/games/prismlauncher/wrapper.nix index dafe7276af881..32c00c63bda57 100644 --- a/pkgs/games/prismlauncher/wrapper.nix +++ b/pkgs/games/prismlauncher/wrapper.nix @@ -18,6 +18,7 @@ , openal , jdk8 , jdk17 +, jdk21 , gamemode , flite , mesa-demos @@ -39,7 +40,7 @@ # itself can take slightly longer to start , withWaylandGLFW ? false -, jdks ? [ jdk17 jdk8 ] +, jdks ? [ jdk21 jdk17 jdk8 ] , additionalLibs ? [ ] , additionalPrograms ? [ ] }: From ca0d3fe0d64da32cbb1b13905bb5a82dc59ffb9f Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sat, 13 Apr 2024 20:50:04 +0200 Subject: [PATCH 6/8] prismlauncher: add vulkan-loader Signed-off-by: Sefa Eyeoglu --- pkgs/games/prismlauncher/wrapper.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/games/prismlauncher/wrapper.nix b/pkgs/games/prismlauncher/wrapper.nix index 32c00c63bda57..d91b2731135e0 100644 --- a/pkgs/games/prismlauncher/wrapper.nix +++ b/pkgs/games/prismlauncher/wrapper.nix @@ -24,6 +24,7 @@ , mesa-demos , pciutils , udev +, vulkan-loader , libusb1 , msaClientID ? null @@ -100,6 +101,7 @@ symlinkJoin { glfw openal stdenv.cc.cc.lib + vulkan-loader # VulkanMod's lwjgl # oshi udev From ed73d3738b68b597bba045672126fea4b1c38927 Mon Sep 17 00:00:00 2001 From: Alice Carroll Date: Sun, 21 Apr 2024 01:25:19 +0300 Subject: [PATCH 7/8] prismlauncher: fix darwin Previously, `glfw-wayland-minecraft` would always be required and the macOS application would be located at `/PrismLauncher.app`, while certain utilities (i.e. `home-manager`) expect it to be at `/Applications/PrismLauncher.app` --- pkgs/games/prismlauncher/default.nix | 6 +++++- pkgs/games/prismlauncher/wrapper.nix | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/games/prismlauncher/default.nix b/pkgs/games/prismlauncher/default.nix index c4571ceaa71bd..df6db702ce499 100644 --- a/pkgs/games/prismlauncher/default.nix +++ b/pkgs/games/prismlauncher/default.nix @@ -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 diff --git a/pkgs/games/prismlauncher/wrapper.nix b/pkgs/games/prismlauncher/wrapper.nix index d91b2731135e0..3393ff45efdcb 100644 --- a/pkgs/games/prismlauncher/wrapper.nix +++ b/pkgs/games/prismlauncher/wrapper.nix @@ -72,7 +72,7 @@ symlinkJoin { ] ++ lib.optional (lib.versionAtLeast qtbase.version "6" && stdenv.isLinux) qtwayland; - waylandPreExec = '' + waylandPreExec = lib.optionalString withWaylandGLFW '' if [ -n "$WAYLAND_DISPLAY" ]; then export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH" fi From 9dcfc53bfcf6911d5e52a7e9aaa27d31ec5a0bce Mon Sep 17 00:00:00 2001 From: seth Date: Tue, 23 Apr 2024 14:21:14 -0400 Subject: [PATCH 8/8] prismlauncher: 8.2 -> 8.3 Diff: https://github.com/PrismLauncher/PrismLauncher/compare/8.2...8.3 Changelog: https://github.com/PrismLauncher/PrismLauncher/releases/tag/8.3 --- pkgs/games/prismlauncher/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/games/prismlauncher/default.nix b/pkgs/games/prismlauncher/default.nix index df6db702ce499..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.2"; + version = "8.3"; src = fetchFromGitHub { owner = "PrismLauncher"; repo = "PrismLauncher"; rev = finalAttrs.version; - hash = "sha256-4VsoxZzi/EfEsnDvvwzg2xhj7j5B+k3gvaSqwJFDweE="; + hash = "sha256-1YGzCgNdzscnOVeNlHMFJa0RbMo6C2qQjtBOeDxHakI="; }; nativeBuildInputs = [ extra-cmake-modules cmake jdk17 ninja canonicalize-jars-hook ];