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