nix: initial support for qt6

This commit is contained in:
Mustafa Çalışkan 2022-05-27 22:42:23 +03:00
parent 0ffe0b6894
commit 0ea2135aa5
2 changed files with 13 additions and 10 deletions

View File

@ -22,7 +22,11 @@
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
in in
{ {
packages = forAllSystems (system: { polymc = pkgs.${system}.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus; }; }); packages = forAllSystems (system: {
polymc = pkgs.${system}.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus; };
polymc-qt6 = pkgs.${system}.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus; };
});
defaultPackage = forAllSystems (system: self.packages.${system}.polymc); defaultPackage = forAllSystems (system: self.packages.${system}.polymc);
apps = forAllSystems (system: { polymc = { type = "app"; program = "${self.defaultPackage.${system}}/bin/polymc"; }; }); apps = forAllSystems (system: { polymc = { type = "app"; program = "${self.defaultPackage.${system}}/bin/polymc"; }; });

View File

@ -1,5 +1,5 @@
{ lib { stdenv
, mkDerivation , lib
, fetchFromGitHub , fetchFromGitHub
, cmake , cmake
, ninja , ninja
@ -7,11 +7,10 @@
, jdk , jdk
, zlib , zlib
, file , file
, makeWrapper , wrapQtAppsHook
, xorg , xorg
, libpulseaudio , libpulseaudio
, qtbase , qtbase
, quazip
, libGL , libGL
, msaClientID ? "" , msaClientID ? ""
@ -37,13 +36,13 @@ let
gameLibraryPath = libpath + ":/run/opengl-driver/lib"; gameLibraryPath = libpath + ":/run/opengl-driver/lib";
in in
mkDerivation rec { stdenv.mkDerivation rec {
pname = "polymc"; pname = "polymc";
inherit version; inherit version;
src = lib.cleanSource self; src = lib.cleanSource self;
nativeBuildInputs = [ cmake ninja jdk file makeWrapper ]; nativeBuildInputs = [ cmake ninja jdk file wrapQtAppsHook ];
buildInputs = [ qtbase quazip zlib ]; buildInputs = [ qtbase quazip zlib ];
dontWrapQtApps = true; dontWrapQtApps = true;
@ -58,13 +57,13 @@ mkDerivation rec {
cmakeFlags = [ cmakeFlags = [
"-GNinja" "-GNinja"
"-DLauncher_PORTABLE=OFF" "-DENABLE_LTO=on"
"-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qtbase.version}"
] ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]; ] ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ];
postInstall = '' postInstall = ''
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
wrapProgram $out/bin/polymc \ wrapQtApp $out/bin/polymc \
"''${qtWrapperArgs[@]}" \
--set GAME_LIBRARY_PATH ${gameLibraryPath} \ --set GAME_LIBRARY_PATH ${gameLibraryPath} \
--prefix POLYMC_JAVA_PATHS : ${jdk}/lib/openjdk/bin/java:${jdk8}/lib/openjdk/bin/java \ --prefix POLYMC_JAVA_PATHS : ${jdk}/lib/openjdk/bin/java:${jdk8}/lib/openjdk/bin/java \
--prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]} --prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]}