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});
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);
apps = forAllSystems (system: { polymc = { type = "app"; program = "${self.defaultPackage.${system}}/bin/polymc"; }; });

View File

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