From dce34fd38b6cd06d2938807c74e731b81f677da6 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 22 Jun 2024 18:26:55 -0400 Subject: [PATCH 1/7] prismlauncher: migrate to by-name --- .../pr/prismlauncher-unwrapped/package.nix} | 15 +++++++-------- .../pr/prismlauncher/package.nix} | 13 +++++-------- pkgs/top-level/all-packages.nix | 6 ------ 3 files changed, 12 insertions(+), 22 deletions(-) rename pkgs/{games/prismlauncher/default.nix => by-name/pr/prismlauncher-unwrapped/package.nix} (87%) rename pkgs/{games/prismlauncher/wrapper.nix => by-name/pr/prismlauncher/package.nix} (93%) diff --git a/pkgs/games/prismlauncher/default.nix b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix similarity index 87% rename from pkgs/games/prismlauncher/default.nix rename to pkgs/by-name/pr/prismlauncher-unwrapped/package.nix index b9b585a4e5031..c846c3991f10b 100644 --- a/pkgs/games/prismlauncher/default.nix +++ b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix @@ -4,12 +4,11 @@ , stripJavaArchivesHook , cmake , cmark -, Cocoa +, darwin , ninja , jdk17 , zlib -, qtbase -, quazip +, kdePackages , extra-cmake-modules , tomlplusplus , ghc_filesystem @@ -43,15 +42,15 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ extra-cmake-modules cmake jdk17 ninja stripJavaArchivesHook ]; buildInputs = [ - qtbase + kdePackages.qtbase zlib - quazip + kdePackages.quazip ghc_filesystem tomlplusplus cmark ] ++ lib.optional gamemodeSupport gamemode - ++ lib.optionals stdenv.isDarwin [ Cocoa ]; + ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]; hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ]; @@ -59,7 +58,7 @@ stdenv.mkDerivation (finalAttrs: { # downstream branding "-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 (lib.versionOlder kdePackages.qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=5" ] ++ lib.optionals stdenv.isDarwin [ "-DINSTALL_BUNDLE=nodeps" "-DMACOSX_SPARKLE_UPDATE_FEED_URL=''" @@ -82,7 +81,7 @@ 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 lib.platforms; linux ++ darwin; + platforms = lib.platforms.linux ++ lib.platforms.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/by-name/pr/prismlauncher/package.nix similarity index 93% rename from pkgs/games/prismlauncher/wrapper.nix rename to pkgs/by-name/pr/prismlauncher/package.nix index f5b21d70844fc..ecd1f67c7ee81 100644 --- a/pkgs/games/prismlauncher/wrapper.nix +++ b/pkgs/by-name/pr/prismlauncher/package.nix @@ -2,14 +2,11 @@ , stdenv , symlinkJoin , makeWrapper -, wrapQtAppsHook , addOpenGLRunpath , prismlauncher-unwrapped -, qtbase # needed for wrapQtAppsHook -, qtsvg -, qtwayland +, kdePackages , xorg , libpulseaudio , libGL @@ -60,17 +57,17 @@ symlinkJoin { paths = [ prismlauncher' ]; nativeBuildInputs = [ - wrapQtAppsHook + kdePackages.wrapQtAppsHook ] # purposefully using a shell wrapper here for variable expansion # see https://github.com/NixOS/nixpkgs/issues/172583 ++ lib.optional withWaylandGLFW makeWrapper; buildInputs = [ - qtbase - qtsvg + kdePackages.qtbase + kdePackages.qtsvg ] - ++ lib.optional (lib.versionAtLeast qtbase.version "6" && stdenv.isLinux) qtwayland; + ++ lib.optional (lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux) kdePackages.qtwayland; waylandPreExec = lib.optionalString withWaylandGLFW '' if [ -n "$WAYLAND_DISPLAY" ]; then diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8d63363da0ea8..b9e125f807928 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -36922,12 +36922,6 @@ with pkgs; principia = callPackage ../games/principia { }; - prismlauncher-unwrapped = kdePackages.callPackage ../games/prismlauncher { - inherit (darwin.apple_sdk.frameworks) Cocoa; - }; - - prismlauncher = kdePackages.callPackage ../games/prismlauncher/wrapper.nix { }; - pong3d = callPackage ../games/pong3d { }; pokerth = libsForQt5.callPackage ../games/pokerth { From b40318aaf71299220228c71a3b14fd1d2880eb37 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 22 Jun 2024 18:27:20 -0400 Subject: [PATCH 2/7] prismlauncher: format with nixfmt --- .../pr/prismlauncher-unwrapped/package.nix | 78 +++++---- pkgs/by-name/pr/prismlauncher/package.nix | 157 +++++++++--------- 2 files changed, 129 insertions(+), 106 deletions(-) diff --git a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix index c846c3991f10b..12f7e1e46bd6b 100644 --- a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix +++ b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix @@ -1,21 +1,21 @@ -{ lib -, stdenv -, fetchFromGitHub -, stripJavaArchivesHook -, cmake -, cmark -, darwin -, ninja -, jdk17 -, zlib -, kdePackages -, extra-cmake-modules -, tomlplusplus -, ghc_filesystem -, gamemode -, msaClientID ? null -, gamemodeSupport ? stdenv.isLinux -, +{ + lib, + stdenv, + fetchFromGitHub, + stripJavaArchivesHook, + cmake, + cmark, + darwin, + kdePackages, + ninja, + jdk17, + zlib, + extra-cmake-modules, + tomlplusplus, + ghc_filesystem, + gamemode, + msaClientID ? null, + gamemodeSupport ? stdenv.isLinux, }: let libnbtplusplus = fetchFromGitHub { @@ -26,7 +26,9 @@ let }; in -assert lib.assertMsg (stdenv.isLinux || !gamemodeSupport) "gamemodeSupport is only available on Linux"; +assert lib.assertMsg ( + stdenv.isLinux || !gamemodeSupport +) "gamemodeSupport is only available on Linux"; stdenv.mkDerivation (finalAttrs: { pname = "prismlauncher-unwrapped"; @@ -39,7 +41,13 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-1YGzCgNdzscnOVeNlHMFJa0RbMo6C2qQjtBOeDxHakI="; }; - nativeBuildInputs = [ extra-cmake-modules cmake jdk17 ninja stripJavaArchivesHook ]; + nativeBuildInputs = [ + extra-cmake-modules + cmake + jdk17 + ninja + stripJavaArchivesHook + ]; buildInputs = [ kdePackages.qtbase @@ -54,16 +62,20 @@ stdenv.mkDerivation (finalAttrs: { hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ]; - cmakeFlags = [ - # downstream branding - "-DLauncher_BUILD_PLATFORM=nixpkgs" - ] ++ lib.optionals (msaClientID != null) [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] - ++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=5" ] - ++ lib.optionals stdenv.isDarwin [ - "-DINSTALL_BUNDLE=nodeps" - "-DMACOSX_SPARKLE_UPDATE_FEED_URL=''" - "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/Applications/" - ]; + cmakeFlags = + [ + # downstream branding + "-DLauncher_BUILD_PLATFORM=nixpkgs" + ] + ++ lib.optionals (msaClientID != null) [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] + ++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") [ + "-DLauncher_QT_VERSION_MAJOR=5" + ] + ++ lib.optionals stdenv.isDarwin [ + "-DINSTALL_BUNDLE=nodeps" + "-DMACOSX_SPARKLE_UPDATE_FEED_URL=''" + "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/Applications/" + ]; postUnpack = '' rm -rf source/libraries/libnbtplusplus @@ -84,6 +96,10 @@ stdenv.mkDerivation (finalAttrs: { platforms = lib.platforms.linux ++ lib.platforms.darwin; changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${finalAttrs.version}"; license = lib.licenses.gpl3Only; - maintainers = with lib.maintainers; [ minion3665 Scrumplex getchoo ]; + maintainers = with lib.maintainers; [ + minion3665 + Scrumplex + getchoo + ]; }; }) diff --git a/pkgs/by-name/pr/prismlauncher/package.nix b/pkgs/by-name/pr/prismlauncher/package.nix index ecd1f67c7ee81..f102c40b3c4f5 100644 --- a/pkgs/by-name/pr/prismlauncher/package.nix +++ b/pkgs/by-name/pr/prismlauncher/package.nix @@ -1,33 +1,34 @@ -{ lib -, stdenv -, symlinkJoin -, makeWrapper -, addOpenGLRunpath - -, prismlauncher-unwrapped - -, kdePackages -, xorg -, libpulseaudio -, libGL -, glfw -, glfw-wayland-minecraft -, openal -, jdk8 -, jdk17 -, jdk21 -, gamemode -, flite -, glxinfo -, pciutils -, udev -, vulkan-loader -, libusb1 - -, msaClientID ? null -, gamemodeSupport ? stdenv.isLinux -, textToSpeechSupport ? stdenv.isLinux -, controllerSupport ? stdenv.isLinux +{ + lib, + stdenv, + symlinkJoin, + makeWrapper, + addOpenGLRunpath, + + prismlauncher-unwrapped, + + kdePackages, + xorg, + libpulseaudio, + libGL, + glfw, + glfw-wayland-minecraft, + openal, + jdk8, + jdk17, + jdk21, + gamemode, + flite, + glxinfo, + pciutils, + udev, + vulkan-loader, + libusb1, + + msaClientID ? null, + gamemodeSupport ? stdenv.isLinux, + textToSpeechSupport ? stdenv.isLinux, + controllerSupport ? stdenv.isLinux, # Adds `glfw-wayland-minecraft` to `LD_LIBRARY_PATH` # when launched on wayland, allowing for the game to be run natively. @@ -36,19 +37,23 @@ # # 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 ? [ ] + withWaylandGLFW ? false, + + jdks ? [ + jdk21 + jdk17 + jdk8 + ], + additionalLibs ? [ ], + additionalPrograms ? [ ], }: -assert lib.assertMsg (withWaylandGLFW -> stdenv.isLinux) "withWaylandGLFW is only available on Linux"; +assert lib.assertMsg ( + withWaylandGLFW -> stdenv.isLinux +) "withWaylandGLFW is only available on Linux"; let - prismlauncher' = prismlauncher-unwrapped.override { - inherit msaClientID gamemodeSupport; - }; + prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; }; in symlinkJoin { @@ -56,18 +61,20 @@ symlinkJoin { paths = [ prismlauncher' ]; - nativeBuildInputs = [ - kdePackages.wrapQtAppsHook - ] - # purposefully using a shell wrapper here for variable expansion - # see https://github.com/NixOS/nixpkgs/issues/172583 - ++ lib.optional withWaylandGLFW makeWrapper; - - buildInputs = [ - kdePackages.qtbase - kdePackages.qtsvg - ] - ++ lib.optional (lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux) kdePackages.qtwayland; + nativeBuildInputs = + [ kdePackages.wrapQtAppsHook ] + # purposefully using a shell wrapper here for variable expansion + # see https://github.com/NixOS/nixpkgs/issues/172583 + ++ lib.optional withWaylandGLFW makeWrapper; + + buildInputs = + [ + kdePackages.qtbase + kdePackages.qtsvg + ] + ++ lib.optional ( + lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux + ) kdePackages.qtwayland; waylandPreExec = lib.optionalString withWaylandGLFW '' if [ -n "$WAYLAND_DISPLAY" ]; then @@ -85,35 +92,35 @@ symlinkJoin { qtWrapperArgs = let - 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 - ] - ++ lib.optional gamemodeSupport gamemode.lib - ++ lib.optional textToSpeechSupport flite - ++ lib.optional controllerSupport libusb1 - ++ additionalLibs; + 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 + ] + ++ lib.optional gamemodeSupport gamemode.lib + ++ lib.optional textToSpeechSupport flite + ++ lib.optional controllerSupport libusb1 + ++ additionalLibs; runtimePrograms = [ xorg.xrandr glxinfo pciutils # need lspci - ] - ++ additionalPrograms; + ] ++ additionalPrograms; in [ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ] From 88039bb875585904972c9598a681e63ed2a18263 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 22 Jun 2024 18:28:11 -0400 Subject: [PATCH 3/7] prismlauncher: 8.3 -> 8.4 Diff: https://github.com/PrismLauncher/PrismLauncher/compare/8.3...8.4 Changelog: https://github.com/PrismLauncher/PrismLauncher/releases/tag/8.4 --- pkgs/by-name/pr/prismlauncher-unwrapped/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix index 12f7e1e46bd6b..dc52196286847 100644 --- a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix +++ b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix @@ -32,13 +32,13 @@ assert lib.assertMsg ( stdenv.mkDerivation (finalAttrs: { pname = "prismlauncher-unwrapped"; - version = "8.3"; + version = "8.4"; src = fetchFromGitHub { owner = "PrismLauncher"; repo = "PrismLauncher"; rev = finalAttrs.version; - hash = "sha256-1YGzCgNdzscnOVeNlHMFJa0RbMo6C2qQjtBOeDxHakI="; + hash = "sha256-460hB91M2hZm+uU1tywJEj20oRd5cz/NDvya8/vJdSA="; }; nativeBuildInputs = [ From 40581e9eed5ec929a67e0c4109a8e83dbeb12f63 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 22 Jun 2024 18:45:41 -0400 Subject: [PATCH 4/7] prismlauncher: refactor this primarily reorders arguments and items in lists, fixes the meta-attributes of the wrapped version of the package, tidies up some comments, and adds new ones to better explain why we do certain things --- .../pr/prismlauncher-unwrapped/package.nix | 53 +++++---- pkgs/by-name/pr/prismlauncher/package.nix | 105 ++++++++++-------- 2 files changed, 86 insertions(+), 72 deletions(-) diff --git a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix index dc52196286847..bc8b9b236d3cf 100644 --- a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix +++ b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix @@ -2,21 +2,23 @@ lib, stdenv, fetchFromGitHub, - stripJavaArchivesHook, cmake, cmark, darwin, + extra-cmake-modules, + gamemode, + ghc_filesystem, + jdk17, kdePackages, ninja, - jdk17, - zlib, - extra-cmake-modules, + stripJavaArchivesHook, tomlplusplus, - ghc_filesystem, - gamemode, + zlib, + msaClientID ? null, gamemodeSupport ? stdenv.isLinux, }: + let libnbtplusplus = fetchFromGitHub { owner = "PrismLauncher"; @@ -27,8 +29,8 @@ let in assert lib.assertMsg ( - stdenv.isLinux || !gamemodeSupport -) "gamemodeSupport is only available on Linux"; + gamemodeSupport -> stdenv.isLinux +) "gamemodeSupport is only available on Linux!"; stdenv.mkDerivation (finalAttrs: { pname = "prismlauncher-unwrapped"; @@ -41,24 +43,30 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-460hB91M2hZm+uU1tywJEj20oRd5cz/NDvya8/vJdSA="; }; + postUnpack = '' + rm -rf source/libraries/libnbtplusplus + ln -s ${libnbtplusplus} source/libraries/libnbtplusplus + ''; + nativeBuildInputs = [ - extra-cmake-modules cmake - jdk17 ninja + extra-cmake-modules + jdk17 stripJavaArchivesHook ]; + buildInputs = [ + cmark + ghc_filesystem kdePackages.qtbase - zlib kdePackages.quazip - ghc_filesystem tomlplusplus - cmark + zlib ] - ++ lib.optional gamemodeSupport gamemode - ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]; + ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ] + ++ lib.optional gamemodeSupport gamemode; hardeningEnable = lib.optionals stdenv.isLinux [ "pie" ]; @@ -72,34 +80,31 @@ stdenv.mkDerivation (finalAttrs: { "-DLauncher_QT_VERSION_MAJOR=5" ] ++ lib.optionals stdenv.isDarwin [ + # we wrap our binary manually "-DINSTALL_BUNDLE=nodeps" + # disable built-in updater "-DMACOSX_SPARKLE_UPDATE_FEED_URL=''" "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/Applications/" ]; - postUnpack = '' - rm -rf source/libraries/libnbtplusplus - ln -s ${libnbtplusplus} source/libraries/libnbtplusplus - ''; - dontWrapQtApps = true; meta = { - mainProgram = "prismlauncher"; - homepage = "https://prismlauncher.org/"; description = "Free, open source launcher for Minecraft"; longDescription = '' Allows you to have multiple, separate instances of Minecraft (each with their own mods, texture packs, saves, etc) and helps you manage them and their associated options with a simple interface. ''; - platforms = lib.platforms.linux ++ lib.platforms.darwin; - changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${finalAttrs.version}"; + homepage = "https://prismlauncher.org/"; + changelog = "https://github.com/PrismLauncher/PrismLauncher/releases/tag/${finalAttrs.src.rev}"; license = lib.licenses.gpl3Only; maintainers = with lib.maintainers; [ minion3665 Scrumplex getchoo ]; + mainProgram = "prismlauncher"; + platforms = lib.platforms.linux ++ lib.platforms.darwin; }; }) diff --git a/pkgs/by-name/pr/prismlauncher/package.nix b/pkgs/by-name/pr/prismlauncher/package.nix index f102c40b3c4f5..c7e299b2a8e14 100644 --- a/pkgs/by-name/pr/prismlauncher/package.nix +++ b/pkgs/by-name/pr/prismlauncher/package.nix @@ -2,33 +2,38 @@ lib, stdenv, symlinkJoin, - makeWrapper, - addOpenGLRunpath, - prismlauncher-unwrapped, - - kdePackages, - xorg, - libpulseaudio, - libGL, + addOpenGLRunpath, + flite, + gamemode, glfw, glfw-wayland-minecraft, - openal, + glxinfo, jdk8, jdk17, jdk21, - gamemode, - flite, - glxinfo, + kdePackages, + libGL, + libpulseaudio, + libusb1, + makeWrapper, + openal, pciutils, udev, vulkan-loader, - libusb1, + xorg, - msaClientID ? null, + additionalLibs ? [ ], + additionalPrograms ? [ ], + controllerSupport ? stdenv.isLinux, gamemodeSupport ? stdenv.isLinux, + jdks ? [ + jdk21 + jdk17 + jdk8 + ], + msaClientID ? null, textToSpeechSupport ? stdenv.isLinux, - controllerSupport ? stdenv.isLinux, # Adds `glfw-wayland-minecraft` to `LD_LIBRARY_PATH` # when launched on wayland, allowing for the game to be run natively. @@ -38,19 +43,11 @@ # 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"; +) "withWaylandGLFW is only available on Linux!"; let prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; }; @@ -76,59 +73,71 @@ symlinkJoin { lib.versionAtLeast kdePackages.qtbase.version "6" && stdenv.isLinux ) kdePackages.qtwayland; - waylandPreExec = lib.optionalString withWaylandGLFW '' - if [ -n "$WAYLAND_DISPLAY" ]; then - export LD_LIBRARY_PATH=${lib.getLib glfw-wayland-minecraft}/lib:"$LD_LIBRARY_PATH" - fi - ''; + env = { + 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 '' + postBuild = + lib.optionalString withWaylandGLFW '' qtWrapperArgs+=(--run "$waylandPreExec") - ''} - - wrapQtAppsHook - ''; + '' + + '' + wrapQtAppsHook + ''; qtWrapperArgs = let runtimeLibs = [ - xorg.libX11 - xorg.libXext - xorg.libXcursor - xorg.libXrandr - xorg.libXxf86vm - # lwjgl + glfw libpulseaudio libGL - glfw openal stdenv.cc.cc.lib + vulkan-loader # VulkanMod's lwjgl - # oshi - udev + udev # oshi + + xorg.libX11 + xorg.libXext + xorg.libXcursor + xorg.libXrandr + xorg.libXxf86vm ] - ++ lib.optional gamemodeSupport gamemode.lib ++ lib.optional textToSpeechSupport flite + ++ lib.optional gamemodeSupport gamemode.lib ++ lib.optional controllerSupport libusb1 ++ additionalLibs; runtimePrograms = [ - xorg.xrandr glxinfo pciutils # need lspci + xorg.xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 ] ++ additionalPrograms; in [ "--prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" ] ++ lib.optionals stdenv.isLinux [ "--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}" - # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 "--prefix PATH : ${lib.makeBinPath runtimePrograms}" ]; - inherit (prismlauncher') meta; + meta = { + inherit (prismlauncher'.meta) + description + longDescription + homepage + changelog + license + maintainers + mainProgram + platforms + ; + }; } From ea1cf5da523b1febfa5078a2c5db09fd056ffe92 Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 22 Jun 2024 18:47:48 -0400 Subject: [PATCH 5/7] prismlauncher: add updateScript --- pkgs/by-name/pr/prismlauncher-unwrapped/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix index bc8b9b236d3cf..c51d285068bff 100644 --- a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix +++ b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix @@ -11,6 +11,7 @@ jdk17, kdePackages, ninja, + nix-update-script, stripJavaArchivesHook, tomlplusplus, zlib, @@ -89,6 +90,10 @@ stdenv.mkDerivation (finalAttrs: { dontWrapQtApps = true; + passthru = { + updateScript = nix-update-script { }; + }; + meta = { description = "Free, open source launcher for Minecraft"; longDescription = '' From 3b2969b1a569e1f95ad0e51b8fdb05f76efdf1cc Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 22 Jun 2024 18:51:20 -0400 Subject: [PATCH 6/7] prismlauncher: improve assertions controllerSupport and textToSpeechSupport have no effect outside of linux and have no reason to be set; both of these work out of the box on darwin without any intervention from us --- pkgs/by-name/pr/prismlauncher-unwrapped/package.nix | 2 +- pkgs/by-name/pr/prismlauncher/package.nix | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix index c51d285068bff..2e8b7efef878a 100644 --- a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix +++ b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix @@ -31,7 +31,7 @@ in assert lib.assertMsg ( gamemodeSupport -> stdenv.isLinux -) "gamemodeSupport is only available on Linux!"; +) "gamemodeSupport is only available on Linux."; stdenv.mkDerivation (finalAttrs: { pname = "prismlauncher-unwrapped"; diff --git a/pkgs/by-name/pr/prismlauncher/package.nix b/pkgs/by-name/pr/prismlauncher/package.nix index c7e299b2a8e14..c6ff6894389d5 100644 --- a/pkgs/by-name/pr/prismlauncher/package.nix +++ b/pkgs/by-name/pr/prismlauncher/package.nix @@ -45,9 +45,17 @@ withWaylandGLFW ? false, }: +assert lib.assertMsg ( + controllerSupport -> stdenv.isLinux +) "controllerSupport only has an effect on Linux."; + +assert lib.assertMsg ( + textToSpeechSupport -> stdenv.isLinux +) "textToSpeechSupport only has an effect on Linux."; + assert lib.assertMsg ( withWaylandGLFW -> stdenv.isLinux -) "withWaylandGLFW is only available on Linux!"; +) "withWaylandGLFW is only available on Linux."; let prismlauncher' = prismlauncher-unwrapped.override { inherit msaClientID gamemodeSupport; }; From 94ad1c37a84a2065fe30470125d577aa5e3b3994 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 23 Jun 2024 14:46:14 -0400 Subject: [PATCH 7/7] prismlauncher: use `lib.cmakeFeature` --- .../by-name/pr/prismlauncher-unwrapped/package.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix index 2e8b7efef878a..2a08500693179 100644 --- a/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix +++ b/pkgs/by-name/pr/prismlauncher-unwrapped/package.nix @@ -74,18 +74,20 @@ stdenv.mkDerivation (finalAttrs: { cmakeFlags = [ # downstream branding - "-DLauncher_BUILD_PLATFORM=nixpkgs" + (lib.cmakeFeature "Launcher_BUILD_PLATFORM" "nixpkgs") + ] + ++ lib.optionals (msaClientID != null) [ + (lib.cmakeFeature "Launcher_MSA_CLIENT_ID" (toString msaClientID)) ] - ++ lib.optionals (msaClientID != null) [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ] ++ lib.optionals (lib.versionOlder kdePackages.qtbase.version "6") [ - "-DLauncher_QT_VERSION_MAJOR=5" + (lib.cmakeFeature "Launcher_QT_VERSION_MAJOR" "5") ] ++ lib.optionals stdenv.isDarwin [ # we wrap our binary manually - "-DINSTALL_BUNDLE=nodeps" + (lib.cmakeFeature "INSTALL_BUNDLE" "nodeps") # disable built-in updater - "-DMACOSX_SPARKLE_UPDATE_FEED_URL=''" - "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/Applications/" + (lib.cmakeFeature "MACOSX_SPARKLE_UPDATE_FEED_URL" "''") + (lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}/Applications/") ]; dontWrapQtApps = true;