Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22368,6 +22368,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";
Expand Down
135 changes: 135 additions & 0 deletions pkgs/by-name/gd/gdlauncher-carbon/package.nix
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is done automatically by all relevant icon users?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I can try again; last time I checked, it didn't seem to work on KDE Plasma.

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 ];
};
})