nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 99 lines 2.4 kB view raw
1{ 2 lib, 3 stdenv, 4 python3Packages, 5 fetchFromGitHub, 6 installShellFiles, 7 jre, 8 9 libX11, 10 libXext, 11 libXcursor, 12 libXrandr, 13 libXxf86vm, 14 libpulseaudio, 15 libGL, 16 glfw, 17 openal, 18 udev, 19 20 textToSpeechSupport ? stdenv.hostPlatform.isLinux, 21 flite, 22}: 23 24let 25 # Copied from the `prismlauncher` package 26 runtimeLibs = [ 27 # lwjgl 28 libGL 29 glfw 30 openal 31 (lib.getLib stdenv.cc.cc) 32 ] 33 ++ lib.optionals stdenv.hostPlatform.isLinux [ 34 libX11 35 libXext 36 libXcursor 37 libXrandr 38 libXxf86vm 39 40 # lwjgl 41 libpulseaudio 42 43 # oshi 44 udev 45 ] 46 ++ lib.optional textToSpeechSupport flite; 47in 48python3Packages.buildPythonApplication (finalAttrs: { 49 pname = "portablemc"; 50 version = "4.4.1"; 51 pyproject = true; 52 53 src = fetchFromGitHub { 54 owner = "mindstorm38"; 55 repo = "portablemc"; 56 tag = "v${finalAttrs.version}"; 57 hash = "sha256-KE1qf6aIcDjwKzrdKDUmriWfAt+vuriew6ixHKm0xs8="; 58 }; 59 60 patches = [ 61 # Use the jre package provided by nixpkgs by default 62 ./use-builtin-java.patch 63 ]; 64 65 nativeBuildInputs = [ installShellFiles ]; 66 67 build-system = [ python3Packages.poetry-core ]; 68 69 dependencies = [ python3Packages.certifi ]; 70 71 # Note: Tests use networking, so we don't run them 72 73 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 74 installShellCompletion --cmd portablemc \ 75 --bash <($out/bin/portablemc show completion bash) \ 76 --zsh <($out/bin/portablemc show completion zsh) 77 ''; 78 79 preFixup = '' 80 makeWrapperArgs+=( 81 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs} 82 --prefix PATH : ${lib.makeBinPath [ jre ]} 83 ) 84 ''; 85 86 meta = { 87 homepage = "https://github.com/mindstorm38/portablemc"; 88 description = "Fast, reliable and cross-platform command-line Minecraft launcher and API for developers"; 89 longDescription = '' 90 A fast, reliable and cross-platform command-line Minecraft launcher and API for developers. 91 Including fast and easy installation of common mod loaders such as Fabric, Forge, NeoForge and Quilt. 92 This launcher is compatible with the standard Minecraft directories. 93 ''; 94 changelog = "https://github.com/mindstorm38/portablemc/releases/tag/${finalAttrs.src.tag}"; 95 license = lib.licenses.gpl3Only; 96 mainProgram = "portablemc"; 97 maintainers = with lib.maintainers; [ tomasajt ]; 98 }; 99})