gdlauncher-carbon: init at 2.0.20 (#297096)

This commit is contained in:
Arne Keller 2024-12-14 14:50:34 +01:00 committed by GitHub
commit 7a5df46320
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 141 additions and 0 deletions

View File

@ -23020,6 +23020,12 @@
githubId = 4044033;
name = "Thomas Sowell";
};
TsubakiDev = {
email = "i@tsubakidev.cc";
github = "TsubakiDev";
githubId = 132794625;
name = "Daniel Wang";
};
ttrei = {
email = "reinis.taukulis@gmail.com";
github = "ttrei";

View File

@ -0,0 +1,135 @@
{
lib,
stdenv,
appimageTools,
fetchurl,
graphicsmagick,
makeWrapper,
copyDesktopItems,
autoPatchelfHook,
xorg,
libpulseaudio,
libGL,
udev,
xdg-utils,
electron,
addDriverRunpath,
makeDesktopItem,
jdk8,
jdk17,
jdk21,
jdks ? [
jdk8
jdk17
jdk21
],
}:
stdenv.mkDerivation (finalAttrs: {
pname = "gdlauncher-carbon";
version = "2.0.20";
src = appimageTools.extract {
inherit (finalAttrs) pname version;
src = fetchurl {
url = "https://cdn-raw.gdl.gg/launcher/GDLauncher__${finalAttrs.version}__linux__x64.AppImage";
hash = "sha256-tI9RU8qO3MHbImOGw2Wl1dksNbhqrYFyGemqms8aAio=";
};
};
nativeBuildInputs = [
graphicsmagick
makeWrapper
copyDesktopItems
autoPatchelfHook
];
buildInputs = [
xorg.libxcb
stdenv.cc.cc.lib
];
strictDeps = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/gdlauncher-carbon/resources
cp -r $src/resources/{binaries,app.asar} $out/share/gdlauncher-carbon/resources/
# The provided icon is a bit large for some systems, so make smaller ones
for size in 48 96 128 256 512; do
gm convert $src/@gddesktop.png -resize ''${size}x''${size} icon_$size.png
install -D icon_$size.png $out/share/icons/hicolor/''${size}x''${size}/apps/gdlauncher-carbon.png
done
runHook postInstall
'';
postConfigure =
let
libPath = lib.makeLibraryPath [
xorg.libX11
xorg.libXext
xorg.libXcursor
xorg.libXrandr
xorg.libXxf86vm
# lwjgl
libpulseaudio
libGL
stdenv.cc.cc.lib
# oshi
udev
];
binPath = lib.makeBinPath [
# Used for opening directories and URLs in the electron app
xdg-utils
# xorg.xrandr needed for LWJGL [2.9.2, 3) https://github.com/LWJGL/lwjgl/issues/128
xorg.xrandr
];
in
''
makeWrapper '${lib.getExe electron}' $out/bin/gdlauncher-carbon \
--prefix GDL_JAVA_PATH : ${lib.makeSearchPath "" jdks} \
--set LD_LIBRARY_PATH ${addDriverRunpath.driverLink}/lib:${libPath} \
--suffix PATH : "${binPath}" \
--set ELECTRON_FORCE_IS_PACKAGED 1 \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--add-flags $out/share/gdlauncher-carbon/resources/app.asar
'';
desktopItems = [
(makeDesktopItem {
# Note the desktop file name should be GDLauncher to match the window's
# client id for window icon purposes on wayland.
name = "GDLauncher";
exec = "gdlauncher-carbon";
icon = "gdlauncher-carbon";
desktopName = "GDLauncher";
comment = finalAttrs.meta.description;
categories = [ "Game" ];
keywords = [
"launcher"
"mod manager"
"minecraft"
];
mimeTypes = [ "x-scheme-handler/gdlauncher" ];
})
];
meta = {
description = "Simple, yet powerful Minecraft custom launcher with a strong focus on the user experience";
homepage = "https://gdlauncher.com/";
license = lib.licenses.bsl11;
maintainers = with lib.maintainers; [
huantian
TsubakiDev
];
platforms = lib.platforms.linux;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
})