blob: 2cabbaaba43d8894fbbe7a014df6d99f09bd2af2 [file] [log] [blame]
Skyler Grey68791c82022-10-31 00:26:04 +00001{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 jdk8,
7 jdk,
8 zlib,
9 file,
10 wrapQtAppsHook,
11 xorg,
12 libpulseaudio,
13 qtbase,
14 libGL,
15 quazip,
16 glfw,
17 openal,
18 msaClientID ? "",
19 jdks ? [jdk jdk8],
20 extra-cmake-modules,
21 tomlplusplus,
22 ghc_filesystem,
23 libnbtplusplus,
24}: let
25 rev = "243600b75babc636bdd1ac0dc8fd5fa4a2db1a0c";
26 sha256 = "sha256-cDwa6NeZew+MubtRmUViLA8gUaoH3AMxD9PdQcgSgSU=";
27
28 libnbtplusplus = fetchFromGitHub {
29 owner = "ljfa-ag";
30 repo = "libnbtplusplus";
31 rev = "v2.5";
32 sha256 = "sha256-4PHKPbWIWAy9ym25M4SnllTkrqnR+g/0AOqyMBZcdX4=";
33 };
34in
35 stdenv.mkDerivation {
36 pname = "prismlauncher";
37 version = builtins.substring 0 7 rev;
38
39 src = fetchFromGitHub {
40 owner = "PlaceholderMC";
41 repo = "PrismLauncher";
42 inherit rev sha256;
43 };
44
45 postUnpack = ''
46 rm -rf source/libraries/libnbtplusplus
47 mkdir source/libraries/libnbtplusplus
48 cp -a ${libnbtplusplus}/* source/libraries/libnbtplusplus
49 chmod -R a+r+w source/libraries/libnbtplusplus
50 chown -R $USER: source/libraries/libnbtplusplus
51 ls source/libraries/libnbtplusplus/*
52 '';
53
54 nativeBuildInputs = [extra-cmake-modules tomlplusplus ghc_filesystem cmake file jdk wrapQtAppsHook];
55 buildInputs = [qtbase zlib quazip];
56
57 cmakeFlags = lib.optionals (msaClientID != "") ["-DLauncher_MSA_CLIENT_ID=${msaClientID}"];
58
59 dontWrapQtApps = true;
60
61 postInstall = let
62 libpath = with xorg;
63 lib.makeLibraryPath [
64 libX11
65 libXext
66 libXcursor
67 libXrandr
68 libXxf86vm
69 libpulseaudio
70 libGL
71 glfw
72 openal
73 stdenv.cc.cc.lib
74 ];
75 in ''
76 # xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
77 wrapQtApp $out/bin/prismlauncher \
78 --set LD_LIBRARY_PATH /run/opengl-driver/lib:${libpath} \
79 --prefix PRISMLAUNCHER_JAVA_PATHS : ${lib.makeSearchPath "bin/java" jdks} \
80 --prefix PATH : ${lib.makeBinPath [xorg.xrandr]}
81 '';
82
83 meta = with lib; {
84 homepage = "https://github.com/PlaceholderMC/PrismLauncher/";
85 description = "A free, open source launcher for Minecraft";
86 longDescription = ''
87 Allows you to have multiple, separate instances of Minecraft (each with
88 their own mods, texture packs, saves, etc) and helps you manage them and
89 their associated options with a simple interface.
90 '';
91 platforms = platforms.linux;
92 /*
93 changelog = "https://github.com/PlaceholderMC/PrismLauncher/releases/tag/${version}";
94 */
95 license = licenses.gpl3Only;
96 maintainers = with maintainers; [minion3665];
97 };
98 }