polymc: init at 1.0.4

This commit is contained in:
Tristan Gosselin-Hane 2022-01-10 20:34:31 -05:00
parent 826f6dfb26
commit f4ef264724
5 changed files with 96 additions and 58 deletions

View File

@ -1,56 +0,0 @@
{ lib, mkDerivation, fetchFromGitHub, cmake, jdk8, jdk, zlib, file, makeWrapper, xorg, libpulseaudio, qtbase, libGL, msaClientID ? "" }:
let
libpath = with xorg; lib.makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm libpulseaudio libGL ];
in mkDerivation rec {
pname = "multimc";
version = "unstable-2021-09-08";
src = fetchFromGitHub {
owner = "MultiMC";
repo = "MultiMC5";
rev = "e2355eb276bf355ca4acf526a0f3cc390aa88f8b";
sha256 = "3G9QPoAbC+uVfUYR0Kq6hnxl9c2mvCzIEYGjwfarQJ8=";
fetchSubmodules = true;
};
nativeBuildInputs = [ cmake file makeWrapper ];
buildInputs = [ qtbase jdk8 zlib ];
patches = [ ./0001-pick-latest-java-first.patch ];
postPatch = ''
# hardcode jdk paths
substituteInPlace launcher/java/JavaUtils.cpp \
--replace 'scanJavaDir("/usr/lib/jvm")' 'javas.append("${jdk}/lib/openjdk/bin/java")' \
--replace 'scanJavaDir("/usr/lib32/jvm")' 'javas.append("${jdk8}/lib/openjdk/bin/java")'
# add client ID
substituteInPlace notsecrets/Secrets.cpp \
--replace 'QString MSAClientID = "";' 'QString MSAClientID = "${msaClientID}";'
'';
cmakeFlags = [ "-DMultiMC_LAYOUT=lin-system" ];
postInstall = ''
install -Dm644 ../launcher/resources/multimc/scalable/multimc.svg $out/share/pixmaps/multimc.svg
install -Dm755 ../launcher/package/linux/multimc.desktop $out/share/applications/multimc.desktop
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
wrapProgram $out/bin/multimc \
--set GAME_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \
--prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]}
'';
meta = with lib; {
homepage = "https://multimc.org/";
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.linux;
license = licenses.asl20;
# upstream don't want us to re-distribute this application:
# https://github.com/NixOS/nixpkgs/issues/131983
hydraPlatforms = [];
maintainers = with maintainers; [ cleverca22 starcraft66 ];
};
}

View File

@ -0,0 +1,92 @@
{ lib
, mkDerivation
, makeDesktopItem
, fetchFromGitHub
, cmake
, jdk8
, jdk
, zlib
, file
, makeWrapper
, xorg
, libpulseaudio
, qtbase
, libGL
, msaClientID ? ""
}:
mkDerivation rec {
pname = "polymc";
version = "1.0.4";
src = fetchFromGitHub {
owner = "PolyMC";
repo = "PolyMC";
rev = version;
sha256 = "sha256-8aya0KfV9F+i2qBpweWcR9hwyTSQkqn2wHdtkCEeNvk=";
fetchSubmodules = true;
};
nativeBuildInputs = [ cmake file makeWrapper ];
buildInputs = [ qtbase jdk8 zlib ];
patches = [ ./0001-pick-latest-java-first.patch ];
postPatch = ''
# hardcode jdk paths
substituteInPlace launcher/java/JavaUtils.cpp \
--replace 'scanJavaDir("/usr/lib/jvm")' 'javas.append("${jdk}/lib/openjdk/bin/java")' \
--replace 'scanJavaDir("/usr/lib32/jvm")' 'javas.append("${jdk8}/lib/openjdk/bin/java")'
'';
cmakeFlags = [ "-DLauncher_LAYOUT=lin-system" ] ++
lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ];
desktopItems = [
(makeDesktopItem {
name = "polymc";
desktopName = "PolyMC";
genericName = "Minecraft Launcher";
comment = "Free, open source launcher and instance manager for Minecraft.";
icon = "launcher";
exec = "polymc";
categories = "Game";
terminal = "false";
})
];
dontWrapQtApps = true;
postInstall = let
libpath = with xorg; lib.makeLibraryPath [
libX11
libXext
libXcursor
libXrandr
libXxf86vm
libpulseaudio
libGL
];
in ''
install -Dm644 ../launcher/resources/multimc/scalable/launcher.svg $out/share/pixmaps/polymc.svg
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
wrapProgram $out/bin/polymc \
"''${qtWrapperArgs[@]}" \
--set GAME_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \
--prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]}
'';
meta = with lib; {
homepage = "https://polymc.org/";
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.linux;
license = licenses.gpl3Plus;
maintainers = with maintainers; [ cleverca22 starcraft66 ];
};
}

View File

@ -1205,6 +1205,8 @@ mapAliases ({
Its new location is obs-studio-plugins.wlrobs.
'';
multimc = throw "multimc was removed from nixpkgs; use polymc instead"; # Added 2022-01-08
/* If these are in the scope of all-packages.nix, they cause collisions
between mixed versions of qt. See:
https://github.com/NixOS/nixpkgs/pull/101369 */

View File

@ -8843,6 +8843,8 @@ with pkgs;
poly2tri-c = callPackage ../development/libraries/poly2tri-c { };
polymc = libsForQt5.callPackage ../games/polymc { };
ponysay = callPackage ../tools/misc/ponysay { };
popfile = callPackage ../tools/text/popfile { };
@ -30840,8 +30842,6 @@ with pkgs;
moon-buggy = callPackage ../games/moon-buggy {};
multimc = libsForQt5.callPackage ../games/multimc { };
inherit (callPackages ../games/minetest {
inherit (darwin) libiconv;
inherit (darwin.apple_sdk.frameworks) OpenGL OpenAL Carbon Cocoa;