{ lib, stdenv, python3Packages, fetchFromGitHub, fetchurl, installShellFiles , libX11, libXext, libXcursor, libXrandr, libXxf86vm, libpulseaudio, libGL, glfw , openal, udev, flite, java ? [ ] }: let runtimeLibs = [ libX11 libXext libXcursor libXrandr libXxf86vm libpulseaudio libGL glfw openal (lib.getLib stdenv.cc.cc) udev ] ++ lib.optional flite; patch = fetchurl { url = "https://raw.githubusercontent.com/NixOS/nixpkgs/refs/heads/nixos-unstable/pkgs/by-name/po/portablemc/use-builtin-java.patch"; hash = ""; }; in python3Packages.buildPythonApplication rec { pname = "portablemc"; version = "4.4.0"; pyproject = true; disabled = python3Packages.pythonOlder "3.8"; src = fetchFromGitHub { owner = "mindstorm38"; repo = "portablemc"; rev = "refs/tags/v${version}"; hash = "sha256-JDosvjbpoDC+xJ15ejcMJd+jA09RLR+whVZblMu+ljk="; }; patches = [ patch ]; nativeBuildInputs = [ installShellFiles ]; build-system = [ python3Packages.poetry-core ]; dependencies = [ python3Packages.certifi ]; postInstall = '' installShellCompletion --cmd portablemc \ --bash <($out/bin/portablemc show completion bash) \ --zsh <($out/bin/portablemc show completion zsh) ''; preFixup = '' makeWrapperArgs+=( --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs} --prefix PATH : ${lib.makeBinPath [ java ]} ) ''; meta = { mainProgram = "portablemc"; maintainers = with lib.maintainers; [ tomasajt uwugda ]; }; }