portablemc: 4.4.1 -> 5.0.3 (#475417)

This commit is contained in:
Toma
2026-05-23 13:18:12 +00:00
committed by GitHub
2 changed files with 87 additions and 94 deletions
+87 -47
View File
@@ -1,96 +1,136 @@
{
lib,
stdenv,
python3Packages,
fetchFromGitHub,
installShellFiles,
jre,
rustPlatform,
pkg-config,
openssl,
makeWrapper,
addDriverRunpath,
alsa-lib,
glfw3-minecraft,
libGL,
libjack2,
libpulseaudio,
libx11,
libxext,
libxcursor,
libxext,
libxrandr,
libxxf86vm,
libpulseaudio,
libGL,
glfw,
openal,
pipewire,
udev,
vulkan-loader,
textToSpeechSupport ? stdenv.hostPlatform.isLinux,
flite,
pciutils,
xrandr,
jdk25,
jdk21,
jdk17,
jdk8,
# can be overriden to reduce the closure size
jvms ? [
jdk25
jdk21
jdk17
jdk8
],
additionalLibs ? [ ],
additionalPrograms ? [ ],
}:
let
# Copied from the `prismlauncher` package
runtimeLibs = [
# lwjgl
libGL
glfw
openal
(lib.getLib stdenv.cc.cc)
]
++ lib.optionals stdenv.hostPlatform.isLinux [
## native versions
glfw3-minecraft
openal
## openal
alsa-lib
libjack2
libpulseaudio
pipewire
## glfw
libGL
libx11
libxext
libxcursor
libxext
libxrandr
libxxf86vm
# lwjgl
libpulseaudio
udev # oshi
# oshi
udev
vulkan-loader # VulkanMod's lwjgl
]
++ lib.optional textToSpeechSupport flite;
++ lib.optional textToSpeechSupport flite
++ additionalLibs;
# Copied from the `prismlauncher` package
runtimePrograms = [
pciutils # need lspci
xrandr # needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
]
++ additionalPrograms;
in
python3Packages.buildPythonApplication (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
pname = "portablemc";
version = "4.4.1";
pyproject = true;
version = "5.0.3";
src = fetchFromGitHub {
owner = "theorzr";
repo = "portablemc";
tag = "v${finalAttrs.version}";
hash = "sha256-KE1qf6aIcDjwKzrdKDUmriWfAt+vuriew6ixHKm0xs8=";
hash = "sha256-P/ah7pwOdbgRDgpvhEDcNA1RiDzG2nYZCR13vzljLd8=";
};
patches = [
# Use the jre package provided by nixpkgs by default
./use-builtin-java.patch
];
dontUnpack = true;
nativeBuildInputs = [ installShellFiles ];
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (finalAttrs) pname version src;
hash = "sha256-Ub9XVc6gcu6fEiOheew9Uh3LqdaSzVKITboDTK+MQUI=";
};
build-system = [ python3Packages.poetry-core ];
unwrapped = rustPlatform.buildRustPackage {
name = "portablemc-${finalAttrs.version}-unwrapped";
inherit (finalAttrs) src cargoDeps;
dependencies = [ python3Packages.certifi ];
nativeBuildInputs = [ pkg-config ];
# Note: Tests use networking, so we don't run them
buildInputs = [ openssl ];
};
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd portablemc \
--bash <($out/bin/portablemc show completion bash) \
--zsh <($out/bin/portablemc show completion zsh)
'';
strictDeps = true;
nativeBuildInputs = [ makeWrapper ];
preFixup = ''
makeWrapperArgs+=(
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs}
--prefix PATH : ${lib.makeBinPath [ jre ]}
)
installPhase = ''
runHook preInstall
makeWrapper "$unwrapped/bin/portablemc" "$out/bin/portablemc" \
${lib.optionalString stdenv.hostPlatform.isLinux ''
--prefix LD_LIBRARY_PATH : "${addDriverRunpath.driverLink}/lib:${lib.makeLibraryPath runtimeLibs}" \
--prefix PATH : "${lib.makeBinPath runtimePrograms}" \
''} \
--prefix PATH : ${lib.makeBinPath jvms}
runHook postInstall
'';
meta = {
homepage = "https://github.com/theorzr/portablemc";
description = "Fast, reliable and cross-platform command-line Minecraft launcher and API for developers";
longDescription = ''
A fast, reliable and cross-platform command-line Minecraft launcher and API for developers.
Including fast and easy installation of common mod loaders such as Fabric, Forge, NeoForge and Quilt.
This launcher is compatible with the standard Minecraft directories.
'';
description = "Cross platform command line utility for launching Minecraft quickly and reliably with included support for Mojang versions and popular mod loaders";
changelog = "https://github.com/theorzr/portablemc/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.gpl3Only;
mainProgram = "portablemc";
@@ -1,47 +0,0 @@
diff --git a/portablemc/standard.py b/portablemc/standard.py
index f59c55d..0f017e1 100644
--- a/portablemc/standard.py
+++ b/portablemc/standard.py
@@ -843,6 +843,8 @@ class Version:
if jvm_major_version is not None and not isinstance(jvm_major_version, int):
raise ValueError("metadata: /javaVersion/majorVersion must be an integer")
+ return self._resolve_builtin_jvm(watcher, JvmNotFoundError.UNSUPPORTED_ARCH, jvm_major_version)
+
if platform.system() == "Linux" and platform.libc_ver()[0] != "glibc":
return self._resolve_builtin_jvm(watcher, JvmNotFoundError.UNSUPPORTED_LIBC, jvm_major_version)
@@ -926,31 +928,10 @@ class Version:
builtin_path = shutil.which(jvm_bin_filename)
if builtin_path is None:
raise JvmNotFoundError(reason)
-
- try:
-
- # Get version of the JVM.
- process = Popen([builtin_path, "-version"], bufsize=1, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
- stdout, _stderr = process.communicate(timeout=1)
-
- version_start = stdout.index(f"1.{major_version}" if major_version <= 8 else str(major_version))
- version = None
-
- # Parse version by getting all character that are numeric or '.'.
- for i, ch in enumerate(stdout[version_start:]):
- if not ch.isnumeric() and ch not in (".", "_"):
- version = stdout[version_start:i]
- break
-
- if version is None:
- raise ValueError()
-
- except (TimeoutExpired, ValueError):
- raise JvmNotFoundError(JvmNotFoundError.BUILTIN_INVALID_VERSION)
self._jvm_path = Path(builtin_path)
- self._jvm_version = version
- watcher.handle(JvmLoadedEvent(version, JvmLoadedEvent.BUILTIN))
+ self._jvm_version = "nixpkgs"
+ watcher.handle(JvmLoadedEvent("nixpkgs", JvmLoadedEvent.BUILTIN))
def _download(self, watcher: Watcher) -> None: