Merge pull request #229918 from Scrumplex/prismlauncher-unwrapped

prismlauncher: add unwrapped packages
This commit is contained in:
Sandro 2023-05-23 01:11:06 +02:00 committed by GitHub
commit 0743acec83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 50 deletions

View File

@ -3,29 +3,17 @@
, fetchFromGitHub
, cmake
, ninja
, jdk8
, jdk17
, zlib
, file
, wrapQtAppsHook
, xorg
, libpulseaudio
, qtbase
, qtsvg
, qtwayland
, libGL
, quazip
, glfw
, openal
, extra-cmake-modules
, tomlplusplus
, ghc_filesystem
, msaClientID ? ""
, jdks ? [ jdk17 jdk8 ]
, gamemodeSupport ? true
, gamemode
, msaClientID ? null
, gamemodeSupport ? true
}:
let
libnbtplusplus = fetchFromGitHub {
owner = "PrismLauncher";
@ -34,9 +22,8 @@ let
sha256 = "sha256-TvVOjkUobYJD9itQYueELJX3wmecvEdCbJ0FinW2mL4=";
};
in
stdenv.mkDerivation rec {
pname = "prismlauncher";
pname = "prismlauncher-unwrapped";
version = "6.3";
src = fetchFromGitHub {
@ -46,51 +33,26 @@ stdenv.mkDerivation rec {
sha256 = "sha256-7tptHKWkbdxTn6VIPxXE1K3opKRiUW2zv9r6J05dcS8=";
};
nativeBuildInputs = [ extra-cmake-modules cmake file jdk17 ninja wrapQtAppsHook ];
nativeBuildInputs = [ extra-cmake-modules cmake jdk17 ninja ];
buildInputs = [
qtbase
qtsvg
zlib
quazip
ghc_filesystem
tomlplusplus
]
++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland
++ lib.optional gamemodeSupport gamemode.dev;
] ++ lib.optional gamemodeSupport gamemode;
cmakeFlags = lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]
hardeningEnable = [ "pie" ];
cmakeFlags = lib.optionals (msaClientID != null) [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]
++ lib.optionals (lib.versionAtLeast qtbase.version "6") [ "-DLauncher_QT_VERSION_MAJOR=6" ];
postUnpack = ''
rm -rf source/libraries/libnbtplusplus
mkdir source/libraries/libnbtplusplus
ln -s ${libnbtplusplus}/* source/libraries/libnbtplusplus
chmod -R +r+w source/libraries/libnbtplusplus
chown -R $USER: source/libraries/libnbtplusplus
ln -s ${libnbtplusplus} source/libraries/libnbtplusplus
'';
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]}"
];
dontWrapQtApps = true;
meta = with lib; {
homepage = "https://prismlauncher.org/";

View File

@ -0,0 +1,75 @@
{ 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;
}

View File

@ -36825,9 +36825,13 @@ with pkgs;
principia = callPackage ../games/principia { };
prismlauncher-qt5 = libsForQt5.callPackage ../games/prismlauncher { };
prismlauncher-qt5-unwrapped = libsForQt5.callPackage ../games/prismlauncher { };
prismlauncher = qt6Packages.callPackage ../games/prismlauncher { };
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 { };
pong3d = callPackage ../games/pong3d { };