Change:
It's common to use custom builds of GLFW with Minecraft, for things like improved Wayland support. At the moment, Prism Launcher is built and wrapped in a . This means that overriding libraries such as GLFW, that aren't actually used in the build process but rather used by prebuilt copies of Minecraft at runtime, result in a binary cache miss - triggering local a rebuild of the entire launcher. I propose that the wrapping pattern is implemented here, building the launch wrapper in a new derivation. This way, runtime dependencies can be changed without changing the hash of the launcher binary derivation.
This sounds like a good idea to me, let's do this

Discussion:
, fetchFromGitHub , cmake , ninja <del> , jdk8 </del> , jdk17 , zlib <del> , file , wrapQtAppsHook , xorg , libpulseaudio </del> , qtbase <del> , qtsvg , qtwayland , libGL </del> , quazip <del> , glfw , openal </del> , extra-cmake-modules , tomlplusplus , ghc_filesystem <del> , msaClientID ? "" , jdks ? [ jdk17 jdk8 ] , gamemodeSupport ? true </del> , gamemode <ins> , msaClientID ? null , gamemodeSupport ? true </ins> }: let libnbtplusplus = fetchFromGitHub { owner = "PrismLauncher";

sha256 = "sha256-TvVOjkUobYJD9itQYueELJX3wmecvEdCbJ0FinW2mL4="; }; in stdenv.mkDerivation rec { <del> pname = "prismlauncher"; </del> <ins> pname = "prismlauncher-unwrapped"; </ins> version = "6.3"; src = fetchFromGitHub {

sha256 = "sha256-7tptHKWkbdxTn6VIPxXE1K3opKRiUW2zv9r6J05dcS8="; }; <del> nativeBuildInputs = [ extra-cmake-modules cmake file jdk17 ninja wrapQtAppsHook ]; </del> <ins> nativeBuildInputs = [ extra-cmake-modules cmake jdk17 ninja ]; </ins> buildInputs = [ qtbase <del> qtsvg </del> zlib quazip ghc_filesystem tomlplusplus <del> ] ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland ++ lib.optional gamemodeSupport gamemode.dev; </del> <ins> ] ++ lib.optional gamemodeSupport gamemode; hardeningEnable = [ "pie" ]; </ins> <del> cmakeFlags = lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] </del> <ins> cmakeFlags = lib.optionals (msaClientID != null) [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] </ins> ++ lib.optionals (lib.versionAtLeast qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=6" ]; postUnpack = '' rm -rf source/libraries/libnbtplusplus <del> mkdir source/libraries/libnbtplusplus ln -s ${libnbtplusplus}/* source/libraries/libnbtplusplus chmod -R +r+w source/libraries/libnbtplusplus chown -R $USER: source/libraries/libnbtplusplus </del> <ins> ln -s ${libnbtplusplus} source/libraries/libnbtplusplus </ins> ''; <del> qtWrapperArgs = let libpath = with xorg; lib.makeLibraryPath ([ libX11 libXext libXcursor libXrandr libXxf86vm libpulseaudio libGL glfw openal stdenv.cc.cc.lib ] ++ lib.optional gamemodeSupport gamemode.lib); in [ "--set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath}" "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 "--prefix PATH : ${lib.makeBinPath [xorg.xrandr]}" ]; </del> <ins> dontWrapQtApps = true; </ins> meta = with lib; { homepage = "https://prismlauncher.org/";

<ins> { lib , stdenv , symlinkJoin , prismlauncher-unwrapped , wrapQtAppsHook , qtbase  # needed for wrapQtAppsHook , qtsvg , qtwayland , xorg , libpulseaudio , libGL , glfw , openal , jdk8 , jdk17 , gamemode , msaClientID ? null , gamemodeSupport ? true , jdks ? [ jdk17 jdk8 ] , additionalLibs ? [ ] }: let prismlauncherFinal = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; }; in symlinkJoin { name = "prismlauncher-${prismlauncherFinal.version}"; paths = [ prismlauncherFinal ]; nativeBuildInputs = [ wrapQtAppsHook ]; buildInputs = [ qtbase qtsvg ] ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland; postBuild = '' wrapQtAppsHook ''; qtWrapperArgs = let libs = (with xorg; [ libX11 libXext libXcursor libXrandr libXxf86vm ]) ++ [ libpulseaudio libGL glfw openal stdenv.cc.cc.lib ] ++ lib.optional gamemodeSupport gamemode.lib ++ additionalLibs; in [ "--set LD_LIBRARY_PATH /run/opengl-driver/lib:${lib.makeLibraryPath libs}" "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 "--prefix PATH : ${lib.makeBinPath [xorg.xrandr]}" ]; inherit (prismlauncherFinal) meta; } </ins>

principia = callPackage ../games/principia { }; <del> prismlauncher-qt5 = libsForQt5.callPackage ../games/prismlauncher { }; </del> <ins> prismlauncher-qt5-unwrapped = libsForQt5.callPackage ../games/prismlauncher { }; </ins> <del> prismlauncher = qt6Packages.callPackage ../games/prismlauncher { }; </del> <ins> prismlauncher-qt5 = libsForQt5.callPackage ../games/prismlauncher/wrapper.nix { prismlauncher-unwrapped = prismlauncher-qt5-unwrapped; }; prismlauncher-unwrapped = qt6Packages.callPackage ../games/prismlauncher { }; prismlauncher = qt6Packages.callPackage ../games/prismlauncher/wrapper.nix { }; </ins> pong3d = callPackage ../games/pong3d { };