From 1aec41faa1a4c0f12e5ae3a8d118e3ef8c08c617 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Thu, 4 Apr 2024 13:50:47 +0200 Subject: [PATCH 1/7] fix nix build Signed-off-by: LordMZTE --- flake.lock | 18 +++---- flake.nix | 9 ++-- nix/default.nix | 119 ++++++++++++++++------------------------------ nix/unwrapped.nix | 68 ++++++++++++++++++++++++++ result | 1 + 5 files changed, 125 insertions(+), 90 deletions(-) create mode 100644 nix/unwrapped.nix create mode 120000 result diff --git a/flake.lock b/flake.lock index a72286bb..5a12e61a 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -34,11 +34,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1658119717, - "narHash": "sha256-4upOZIQQ7Bc4CprqnHsKnqYfw+arJeAuU+QcpjYBXW0=", + "lastModified": 1712129508, + "narHash": "sha256-FBVpEX0eLiqX3jnSL3rmJHqHhbuCikJZyDyV3Cl3qAY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9eb60f25aff0d2218c848dd4574a0ab5e296cabe", + "rev": "d03a4482228d4d6dbd2d4b425b6dfcd49ebe765f", "type": "github" }, "original": { @@ -59,11 +59,11 @@ "tomlplusplus": { "flake": false, "locked": { - "lastModified": 1664034574, - "narHash": "sha256-EFMAl6tsTvkgK0DWC/pZfOIq06b2e5SnxJa1ngGRIQA=", + "lastModified": 1710824845, + "narHash": "sha256-A9XuCfVcLle/tMNaH7aqb1leM+t3wwC9ER5RIbMMovo=", "owner": "marzer", "repo": "tomlplusplus", - "rev": "8aa5c8b2a4ff2c440d4630addf64fa4f62146170", + "rev": "1f7884e59165e517462f922e7b6de131bd9844f3", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 93192725..b5ba57d1 100644 --- a/flake.nix +++ b/flake.nix @@ -23,8 +23,11 @@ pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); packagesFn = pkgs: rec { - polymc = pkgs.libsForQt5.callPackage ./nix { inherit version self libnbtplusplus tomlplusplus; }; - polymc-qt6 = pkgs.qt6Packages.callPackage ./nix { inherit version self libnbtplusplus tomlplusplus; }; + polymc-unwrapped = pkgs.qt6Packages.callPackage ./nix/unwrapped.nix { inherit version self libnbtplusplus tomlplusplus; }; + polymc-qt5-unwrapped = pkgs.libsForQt5.callPackage ./nix/unwrapped.nix { inherit version self libnbtplusplus tomlplusplus; }; + polymc = pkgs.qt6Packages.callPackage ./nix { inherit version self polymc-unwrapped; }; + polymc-qt5 = pkgs.libsForQt5.callPackage ./nix { inherit version self; polymc-unwrapped = polymc-qt5-unwrapped; }; + default = polymc; }; in { @@ -33,6 +36,6 @@ packages // { default = packages.polymc; } ); - overlay = final: packagesFn; + overlay = final: prev: packagesFn final; }; } diff --git a/nix/default.nix b/nix/default.nix index 5053eaf8..9949f878 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,101 +1,64 @@ { stdenv , lib -, fetchFromGitHub -, cmake -, ninja -, jdk8 -, jdk -, ghc_filesystem -, zlib -, file +, symlinkJoin +, addOpenGLRunpath +, polymc-unwrapped , wrapQtAppsHook +, jdk8 +, jdk17 , xorg , libpulseaudio , qtbase -, quazip , libGL +, glfw +, openal +, udev , msaClientID ? "" -, extraJDKs ? [ ] -, extra-cmake-modules -, qtcharts +, jdks ? [ jdk17 jdk8 ] +, enableLTO ? false # flake , self , version -, libnbtplusplus -, tomlplusplus -, enableLTO ? false }: let - # Libraries required to run Minecraft - libpath = with xorg; lib.makeLibraryPath [ - libX11 - libXext - libXcursor - libXrandr - libXxf86vm - libpulseaudio - libGL - ]; - - # This variable will be passed to Minecraft by PolyMC - gameLibraryPath = libpath + ":/run/opengl-driver/lib"; - - javaPaths = lib.makeSearchPath "bin/java" ([ jdk jdk8 ] ++ extraJDKs); + polymcInner = polymc-unwrapped.override { inherit msaClientID enableLTO; }; in -stdenv.mkDerivation rec { - pname = "polymc"; +symlinkJoin { + name = "polymc"; inherit version; - src = lib.cleanSource self; + paths = [ polymcInner ]; - nativeBuildInputs = [ cmake extra-cmake-modules ninja jdk ghc_filesystem file wrapQtAppsHook ]; - buildInputs = [ qtbase quazip zlib qtcharts ]; + nativeBuildInputs = [ wrapQtAppsHook ]; + buildInputs = [ qtbase ]; - dontWrapQtApps = true; - - postUnpack = '' - # Copy libnbtplusplus - rm -rf source/libraries/libnbtplusplus - mkdir source/libraries/libnbtplusplus - cp -a ${libnbtplusplus}/* source/libraries/libnbtplusplus - chmod a+r+w source/libraries/libnbtplusplus/* - # Copy tomlplusplus - rm -rf source/libraries/tomlplusplus - mkdir source/libraries/tomlplusplus - cp -a ${tomlplusplus}/* source/libraries/tomlplusplus - chmod a+r+w source/libraries/tomlplusplus/* + postBuild = '' + wrapQtAppsHook ''; - cmakeFlags = [ - "-GNinja" - "-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qtbase.version}" - ] ++ lib.optionals enableLTO [ "-DENABLE_LTO=on" ] - ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]; - - # we have to check if the system is NixOS before adding stdenv.cc.cc.lib (#923) - postInstall = '' - # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128 - wrapQtApp $out/bin/polymc \ - --run '[ -f /etc/NIXOS ] && export LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH"' \ - --prefix LD_LIBRARY_PATH : ${gameLibraryPath} \ - --prefix POLYMC_JAVA_PATHS : ${javaPaths} \ - --prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]} - ''; - - meta = with lib; { - homepage = "https://polymc.org/"; - downloadPage = "https://polymc.org/download/"; - changelog = "https://github.com/PolyMC/PolyMC/releases"; - description = "A 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 = platforms.unix; - license = licenses.gpl3Only; - maintainers = with maintainers; [ starcraft66 kloenk ]; - }; + qtWrapperArgs = + let + runtimeLibs = (with xorg; [ + libX11 + libXext + libXcursor + libXrandr + libXxf86vm + ]) ++ + # lwjgl + [ + libpulseaudio + libGL + glfw + openal + stdenv.cc.cc.lib + udev # OSHI + ]; + in + [ + "--prefix POLYMC_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" + "--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}" + ]; } diff --git a/nix/unwrapped.nix b/nix/unwrapped.nix new file mode 100644 index 00000000..b46f550c --- /dev/null +++ b/nix/unwrapped.nix @@ -0,0 +1,68 @@ +{ stdenv +, lib +, cmake +, ninja +, jdk8 +, ghc_filesystem +, zlib +, file +, qtbase +, quazip +, msaClientID ? "" +, extra-cmake-modules +, qtcharts +, qtwayland + # flake +, self +, version +, libnbtplusplus +, tomlplusplus +, enableLTO ? false +}: + +stdenv.mkDerivation { + pname = "polymc-unwrapped"; + inherit version; + + src = lib.cleanSource self; + + nativeBuildInputs = [ cmake extra-cmake-modules ninja jdk8 ghc_filesystem file ]; + buildInputs = [ qtbase quazip zlib qtcharts ] ++ lib.optional (lib.versionAtLeast qtbase.version "6") qtwayland; + + postUnpack = '' + # Copy libnbtplusplus + rm -rf source/libraries/libnbtplusplus + mkdir source/libraries/libnbtplusplus + cp -a ${libnbtplusplus}/* source/libraries/libnbtplusplus + chmod a+r+w source/libraries/libnbtplusplus/* + # Copy tomlplusplus + rm -rf source/libraries/tomlplusplus + mkdir source/libraries/tomlplusplus + cp -a ${tomlplusplus}/* source/libraries/tomlplusplus + chmod a+r+w source/libraries/tomlplusplus/* + ''; + + dontWrapQtApps = true; + + cmakeFlags = [ + "-GNinja" + "-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qtbase.version}" + ] + ++ lib.optionals enableLTO [ "-DENABLE_LTO=on" ] + ++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ]; + + meta = with lib; { + homepage = "https://polymc.org/"; + downloadPage = "https://polymc.org/download/"; + changelog = "https://github.com/PolyMC/PolyMC/releases"; + description = "A 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 = platforms.unix; + license = licenses.gpl3Only; + maintainers = with maintainers; [ starcraft66 kloenk ]; + }; +} diff --git a/result b/result new file mode 120000 index 00000000..8dbf1b43 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/2j0ah2qm5cghawl94l76bmwbsdw5bb57-polymc \ No newline at end of file From 4bbc7bad4c2829203256eaa6b93796b7163cc09c Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Fri, 5 Apr 2024 11:03:07 +0200 Subject: [PATCH 2/7] Fix nix meta Signed-off-by: LordMZTE --- nix/default.nix | 2 ++ result | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 120000 result diff --git a/nix/default.nix b/nix/default.nix index 9949f878..907c447f 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -61,4 +61,6 @@ symlinkJoin { "--prefix POLYMC_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks}" "--set LD_LIBRARY_PATH ${addOpenGLRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}" ]; + + inherit (polymcInner) meta; } diff --git a/result b/result deleted file mode 120000 index 8dbf1b43..00000000 --- a/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/2j0ah2qm5cghawl94l76bmwbsdw5bb57-polymc \ No newline at end of file From 15df4bb751c4257f3a86c5283a55587c56d0cd36 Mon Sep 17 00:00:00 2001 From: Zebulan Stanphill Date: Sun, 28 Apr 2024 14:50:29 -0500 Subject: [PATCH 3/7] Fix recursive dependency in metainfo. Signed-off-by: Zebulan Stanphill --- program_info/org.polymc.PolyMC.metainfo.xml.in | 3 --- 1 file changed, 3 deletions(-) diff --git a/program_info/org.polymc.PolyMC.metainfo.xml.in b/program_info/org.polymc.PolyMC.metainfo.xml.in index ef5a7d93..99eefe67 100644 --- a/program_info/org.polymc.PolyMC.metainfo.xml.in +++ b/program_info/org.polymc.PolyMC.metainfo.xml.in @@ -1,9 +1,6 @@ org.polymc.PolyMC - - org.polymc.PolyMC - org.polymc.PolyMC.desktop PolyMC PolyMC From 19d34dd302297f40a75929d9c037cf7ec858b655 Mon Sep 17 00:00:00 2001 From: Zebulan Stanphill Date: Sun, 28 Apr 2024 14:51:13 -0500 Subject: [PATCH 4/7] Fix capitalization and add Oxford commas in metainfo. Signed-off-by: Zebulan Stanphill --- program_info/org.polymc.PolyMC.metainfo.xml.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/program_info/org.polymc.PolyMC.metainfo.xml.in b/program_info/org.polymc.PolyMC.metainfo.xml.in index 99eefe67..2b72c329 100644 --- a/program_info/org.polymc.PolyMC.metainfo.xml.in +++ b/program_info/org.polymc.PolyMC.metainfo.xml.in @@ -10,15 +10,15 @@ https://polymc.org/ https://polymc.org/wiki/ -

PolyMC is a custom launcher for Minecraft that focuses on predictability, long term stability and simplicity.

+

PolyMC is a custom launcher for Minecraft that focuses on predictability, long term stability, and simplicity.

Features:

    -
  • Easily install game modifications, such as Fabric, Forge and Quilt
  • -
  • Control your java settings
  • +
  • Easily install game modifications, such as Fabric, Forge, and Quilt
  • +
  • Control your Java settings
  • Manage worlds and resource packs from the launcher
  • See logs and other details easily
  • Kill Minecraft in case of a crash/freeze
  • -
  • Isolate minecraft instances to keep everything clean
  • +
  • Isolate Minecraft instances to keep everything clean
  • Install and update mods directly from the launcher
From f2f38691e7d2e5b55633a995402f9ce18bbc9748 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Thu, 2 May 2024 16:41:21 +0200 Subject: [PATCH 5/7] Fix nix package on wayland The nix package was missing the dependencies required for qtwayland to work. This has been fixed. Signed-off-by: LordMZTE --- nix/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nix/default.nix b/nix/default.nix index 907c447f..a5220a38 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -13,6 +13,8 @@ , glfw , openal , udev +, wayland +, qtwayland , msaClientID ? "" , jdks ? [ jdk17 jdk8 ] , enableLTO ? false @@ -32,7 +34,7 @@ symlinkJoin { paths = [ polymcInner ]; nativeBuildInputs = [ wrapQtAppsHook ]; - buildInputs = [ qtbase ]; + buildInputs = [ qtbase qtwayland ]; postBuild = '' wrapQtAppsHook @@ -55,6 +57,7 @@ symlinkJoin { openal stdenv.cc.cc.lib udev # OSHI + wayland ]; in [ From 1b8d45d04f71e119903382130fec670818765d8d Mon Sep 17 00:00:00 2001 From: Hustler One Date: Wed, 19 Jun 2024 11:48:43 +0200 Subject: [PATCH 6/7] fix small oversight for new minecraft versions (JDK 21 is now mandatory for 1.20.5+) --- nix/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nix/default.nix b/nix/default.nix index a5220a38..7f225ea6 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -6,6 +6,7 @@ , wrapQtAppsHook , jdk8 , jdk17 +, jdk21 , xorg , libpulseaudio , qtbase @@ -16,7 +17,7 @@ , wayland , qtwayland , msaClientID ? "" -, jdks ? [ jdk17 jdk8 ] +, jdks ? [ jdk21 jdk17 jdk8 ] , enableLTO ? false # flake , self From 2adf3db7bc2fc1fb991e62b969c088f7fe7d06a0 Mon Sep 17 00:00:00 2001 From: Hustler One Date: Wed, 19 Jun 2024 12:06:57 +0200 Subject: [PATCH 7/7] DCO Remediation Commit for Hustler One I, Hustler One , hereby add my Signed-off-by to this commit: 1b8d45d04f71e119903382130fec670818765d8d Signed-off-by: Hustler One --- nix/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/default.nix b/nix/default.nix index 7f225ea6..94a156ed 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -19,9 +19,9 @@ , msaClientID ? "" , jdks ? [ jdk21 jdk17 jdk8 ] , enableLTO ? false - # flake , self , version + # flake }: let