Skip to content

Instantly share code, notes, and snippets.

@cidkidnix
Created December 22, 2021 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cidkidnix/0e9734bb4129035739b4f3d667fd5d58 to your computer and use it in GitHub Desktop.
Save cidkidnix/0e9734bb4129035739b4f3d667fd5d58 to your computer and use it in GitHub Desktop.
polymc nixos package
{ 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 = "polymc";
version = "unstable-2021-09-08";
src = fetchFromGitHub {
owner = "PolyMC";
repo = "PolyMC";
rev = "d0c51b751134a1f5b56609b72cec174f6bc4ef53";
sha256 = "sha256-PEO/BsCDqzcoRjKBl3Qbi/bYrsdoQFLcFCYwWUhn4Lk=";
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" ];
postInstall = ''
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
wrapProgram $out/bin/polymc \
--set GAME_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \
--prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]}
'';
meta = with lib; {
homepage = "https://github.com/PolyMC/PolyMC";
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.gpl3;
maintainers = with maintainers; [ cidkid ];
};
}
@binex-dsk
Copy link

Just found this from search engine. Feel free to make a PR to include this in the repo, or submit this to NixOS and open a PR to add the package to README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment