tlauncher-nix/default.nix

36 lines
922 B
Nix
Raw Normal View History

2024-12-12 20:03:25 -03:00
{
lib,
stdenv,
makeWrapper,
jre,
zenity,
writeShellScript,
2023-05-19 10:45:20 -03:00
}:
let
warnScript = writeShellScript "warn-tlauncher-jre-version" ''
if ! test -d "$HOME/.tlauncher"; then
2024-12-12 20:03:25 -03:00
${zenity}/bin/zenity --warning \
2023-05-19 10:45:20 -03:00
--text="On Tlauncher settings, set Java/JRE to 'Current only', otherwise minecraft will fail to launch."
fi
'';
in
stdenv.mkDerivation rec {
name = "tlauncher";
src = ./TL_mcl.jar;
dontUnpack = true;
nativeBuildInputs = [ makeWrapper ];
runtimeDeps = [ jre ];
installPhase = ''
install -Dm555 $src $out/share/tlauncher/tlauncher.jar
makeWrapper "${jre}/bin/java" "$out/bin/tlauncher" \
--run ${warnScript} \
--add-flags "-jar $out/share/tlauncher/tlauncher.jar" \
--prefix PATH : ${lib.makeBinPath runtimeDeps} \
--set _JAVA_AWT_WM_NONREPARENTING 1
2023-05-19 10:52:08 -03:00
install -DT ${./tlauncher.desktop} $out/share/applications/tlauncher.desktop
2023-05-19 10:45:20 -03:00
'';
}