2022-05-27 22:42:23 +03:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2022-01-08 21:55:19 +03:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2022-01-09 01:23:53 +03:00
|
|
|
, ninja
|
2022-01-08 21:55:19 +03:00
|
|
|
, jdk8
|
|
|
|
, jdk
|
2022-10-15 13:13:56 +02:00
|
|
|
, ghc_filesystem
|
2022-01-08 21:55:19 +03:00
|
|
|
, zlib
|
|
|
|
, file
|
2022-05-27 22:42:23 +03:00
|
|
|
, wrapQtAppsHook
|
2022-01-08 21:55:19 +03:00
|
|
|
, xorg
|
|
|
|
, libpulseaudio
|
|
|
|
, qtbase
|
2022-05-29 17:07:12 +03:00
|
|
|
, quazip
|
2022-01-08 21:55:19 +03:00
|
|
|
, libGL
|
2022-01-09 12:00:37 -06:00
|
|
|
, msaClientID ? ""
|
2022-06-06 22:13:10 -04:00
|
|
|
, extraJDKs ? [ ]
|
2022-07-03 10:28:41 +01:00
|
|
|
, extra-cmake-modules
|
2022-01-09 09:08:39 +03:00
|
|
|
|
2022-03-13 18:18:46 +02:00
|
|
|
# flake
|
2022-01-08 23:09:53 +03:00
|
|
|
, self
|
2022-03-13 18:18:46 +02:00
|
|
|
, version
|
|
|
|
, libnbtplusplus
|
2022-09-26 15:42:45 +02:00
|
|
|
, tomlplusplus
|
2022-05-29 17:07:12 +03:00
|
|
|
, enableLTO ? false
|
2022-01-08 21:55:19 +03:00
|
|
|
}:
|
2022-01-08 01:33:26 -06:00
|
|
|
|
|
|
|
let
|
2022-01-09 09:08:39 +03:00
|
|
|
# Libraries required to run Minecraft
|
|
|
|
libpath = with xorg; lib.makeLibraryPath [
|
2022-01-08 21:55:19 +03:00
|
|
|
libX11
|
|
|
|
libXext
|
|
|
|
libXcursor
|
|
|
|
libXrandr
|
|
|
|
libXxf86vm
|
|
|
|
libpulseaudio
|
|
|
|
libGL
|
2022-03-13 18:18:46 +02:00
|
|
|
];
|
2022-01-09 09:08:39 +03:00
|
|
|
|
2022-10-18 09:01:48 +02:00
|
|
|
# This variable will be passed to Minecraft by Prism Launcher
|
2022-01-09 09:08:39 +03:00
|
|
|
gameLibraryPath = libpath + ":/run/opengl-driver/lib";
|
2022-06-06 22:13:10 -04:00
|
|
|
|
|
|
|
javaPaths = lib.makeSearchPath "bin/java" ([ jdk jdk8 ] ++ extraJDKs);
|
2022-01-08 21:55:19 +03:00
|
|
|
in
|
|
|
|
|
2022-05-27 22:42:23 +03:00
|
|
|
stdenv.mkDerivation rec {
|
2022-10-18 09:01:48 +02:00
|
|
|
pname = "prismlauncher";
|
2022-03-13 18:18:46 +02:00
|
|
|
inherit version;
|
2022-01-08 21:55:19 +03:00
|
|
|
|
2022-01-08 23:09:53 +03:00
|
|
|
src = lib.cleanSource self;
|
2022-01-08 21:55:19 +03:00
|
|
|
|
2022-10-15 13:13:56 +02:00
|
|
|
nativeBuildInputs = [ cmake extra-cmake-modules ninja jdk ghc_filesystem file wrapQtAppsHook ];
|
2022-05-27 22:23:33 +03:00
|
|
|
buildInputs = [ qtbase quazip zlib ];
|
2022-01-08 01:33:26 -06:00
|
|
|
|
2022-01-09 09:08:39 +03:00
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2022-01-08 23:09:53 +03:00
|
|
|
postUnpack = ''
|
2022-05-27 22:23:33 +03:00
|
|
|
# Copy libnbtplusplus
|
|
|
|
rm -rf source/libraries/libnbtplusplus
|
|
|
|
mkdir source/libraries/libnbtplusplus
|
2022-10-19 23:16:42 +01:00
|
|
|
ln -s ${libnbtplusplus}/* source/libraries/libnbtplusplus
|
|
|
|
chmod -R +r+w source/libraries/libnbtplusplus
|
2022-09-26 15:42:45 +02:00
|
|
|
# Copy tomlplusplus
|
|
|
|
rm -rf source/libraries/tomlplusplus
|
|
|
|
mkdir source/libraries/tomlplusplus
|
2022-10-19 23:16:42 +01:00
|
|
|
ln -s ${tomlplusplus}/* source/libraries/tomlplusplus
|
|
|
|
chmod -R +r+w source/libraries/tomlplusplus
|
2022-01-08 23:09:53 +03:00
|
|
|
'';
|
2022-01-08 01:33:26 -06:00
|
|
|
|
2022-01-08 21:55:19 +03:00
|
|
|
cmakeFlags = [
|
2022-01-09 01:23:53 +03:00
|
|
|
"-GNinja"
|
2022-05-27 22:42:23 +03:00
|
|
|
"-DLauncher_QT_VERSION_MAJOR=${lib.versions.major qtbase.version}"
|
2022-05-29 17:07:12 +03:00
|
|
|
] ++ lib.optionals enableLTO [ "-DENABLE_LTO=on" ]
|
2022-10-19 23:16:42 +01:00
|
|
|
++ lib.optionals (msaClientID != "") [ "-DLauncher_MSA_CLIENT_ID=${msaClientID}" ];
|
2022-01-08 21:55:19 +03:00
|
|
|
|
2022-07-18 17:53:24 +08:00
|
|
|
# we have to check if the system is NixOS before adding stdenv.cc.cc.lib (#923)
|
2022-01-08 01:33:26 -06:00
|
|
|
postInstall = ''
|
|
|
|
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
|
2022-10-18 09:01:48 +02:00
|
|
|
wrapQtApp $out/bin/prismlauncher \
|
2022-07-12 12:09:23 +02:00
|
|
|
--run '[ -f /etc/NIXOS ] && export LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH"' \
|
|
|
|
--prefix LD_LIBRARY_PATH : ${gameLibraryPath} \
|
2022-10-18 09:01:48 +02:00
|
|
|
--prefix PRISMLAUNCHER_JAVA_PATHS : ${javaPaths} \
|
2022-01-29 17:38:12 +03:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ xorg.xrandr ]}
|
2022-01-08 01:33:26 -06:00
|
|
|
'';
|
2022-02-14 16:37:56 +01:00
|
|
|
|
|
|
|
meta = with lib; {
|
2022-10-18 09:01:48 +02:00
|
|
|
homepage = "https://prismlauncher.org/";
|
|
|
|
downloadPage = "https://prismlauncher.org/download/";
|
|
|
|
changelog = "https://github.com/PrismLauncher/PrismLauncher/releases";
|
2022-02-14 16:37:56 +01:00
|
|
|
description = "A free, open source launcher for Minecraft";
|
|
|
|
longDescription = ''
|
|
|
|
Allows you to have multiple, separate instances of Minecraft (each with
|
|
|
|
their own mods, texture packs, saves, etc) and helps you manage them and
|
|
|
|
their associated options with a simple interface.
|
|
|
|
'';
|
|
|
|
platforms = platforms.unix;
|
2022-07-23 13:56:25 +02:00
|
|
|
license = licenses.gpl3Only;
|
2022-10-19 23:16:42 +01:00
|
|
|
maintainers = with maintainers; [ minion3665 Scrumplex ];
|
2022-02-14 16:37:56 +01:00
|
|
|
};
|
2022-01-08 21:55:19 +03:00
|
|
|
}
|