nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 rec {
49 pname = "portablemc";
50 version = "4.4.1";
51 pyproject = true;
52
53 disabled = python3Packages.pythonOlder "3.8";
54
55 src = fetchFromGitHub {
56 owner = "mindstorm38";
57 repo = "portablemc";
58 tag = "v${version}";
59 hash = "sha256-KE1qf6aIcDjwKzrdKDUmriWfAt+vuriew6ixHKm0xs8=";
60 };
61
62 patches = [
63 # Use the jre package provided by nixpkgs by default
64 ./use-builtin-java.patch
65 ];
66
67 nativeBuildInputs = [ installShellFiles ];
68
69 build-system = [ python3Packages.poetry-core ];
70
71 dependencies = [ python3Packages.certifi ];
72
73 # Note: Tests use networking, so we don't run them
74
75 postInstall = ''
76 installShellCompletion --cmd portablemc \
77 --bash <($out/bin/portablemc show completion bash) \
78 --zsh <($out/bin/portablemc show completion zsh)
79 '';
80
81 preFixup = ''
82 makeWrapperArgs+=(
83 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs}
84 --prefix PATH : ${lib.makeBinPath [ jre ]}
85 )
86 '';
87
88 meta = {
89 homepage = "https://github.com/mindstorm38/portablemc";
90 description = "Fast, reliable and cross-platform command-line Minecraft launcher and API for developers";
91 longDescription = ''
92 A fast, reliable and cross-platform command-line Minecraft launcher and API for developers.
93 Including fast and easy installation of common mod loaders such as Fabric, Forge, NeoForge and Quilt.
94 This launcher is compatible with the standard Minecraft directories.
95 '';
96 changelog = "https://github.com/mindstorm38/portablemc/releases/tag/v${version}";
97 license = lib.licenses.gpl3Only;
98 mainProgram = "portablemc";
99 maintainers = with lib.maintainers; [ tomasajt ];
100 };
101}