GDLauncher icon indicating copy to clipboard operation
GDLauncher copied to clipboard

Cookies / “Manage my data” window does not open on NixOS (v2.0.22)

Open yavuzselimkolbasar opened this issue 4 months ago • 0 comments

Describe the bug: The “Manage my data” (cookies/privacy) window in GDLauncher Carbon fails to open on NixOS. Clicking Settings > Privacy > Manage my data results in an error and the window does not appear.

To Reproduce:

  1. Open GDLauncher Carbon v2.0.22 on NixOS.
  2. Go to Settings > Privacy > Manage my data.
  3. Observe that no window opens, and the following error appears in the terminal.

Expected behavior: The cookies/privacy window should open and allow managing stored data.

Error Message:

23:43:56.143 › APPIMAGE env is not defined, current application is not an AppImage
23:44:01.031 › Error occurred in handler for 'openCMPWindow': TypeError: Cannot read properties of undefined (reading 'openCMPWindow')
    at /nix/store/vyc9k6q8mhxk46h2p0w7lcbsaj0h143h-gdlauncher-carbon-2.0.22/share/gdlauncher-carbon/resources/app.asar/dist/main/index.cjs:108:57179
    at WebContents.<anonymous> (node:electron/js2c/browser_init:2:89264)
    at WebContents.emit (node:events:518:28)
    at WebContents.emit (node:domain:489:12)
    at i.emit (/nix/store/vyc9k6q8mhxk46h2p0w7lcbsaj0h143h-gdlauncher-carbon-2.0.22/share/gdlauncher-carbon/resources/app.asar/dist/main/index.cjs:45:200016)

Operating System:

  • NixOS (latest stable)

Launcher Version:

  • GDLauncher Carbon v2.0.22
  • Nix package: gdlauncher-carbon

Nix Package Details (package.nix):

{
  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.22";

  src = appimageTools.extract {
    inherit (finalAttrs) pname version;
    src = fetchurl {
      url = "https://cdn-raw.gdl.gg/launcher/GDLauncher__${finalAttrs.version}__linux__x64.AppImage";
      hash = "sha256-b1d39cSuVJ17rx8vjlYlyIUvqkBbhCWXuq4Z96K1I3M=";
    };
  };

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

Additional context / Possible cause:

  • The openCMPWindow function is undefined in this NixOS package.
  • The Cookies database exists at ~/.local/share/gdlauncher_carbon/Cookies, but the UI to manage it fails to load.
  • Running the official AppImage works normally, suggesting this is specific to the Nix packaging process.
  • Electron warnings about deprecated session.getPreloads / session.setPreloads appear but are not fatal.

Suggested Workarounds / Solutions:

  • Patch the ASAR file to stub or disable openCMPWindow.
  • Use the official AppImage instead of the Nix package.
  • Consider including Overwolf/CMP integration in the Nix package build to restore full functionality.

Steps for maintainers to reproduce in NixOS:

  1. Build the package from the provided package.nix.
  2. Launch GDLauncher Carbon.
  3. Open Settings > Privacy > Manage my data and observe the error.

yavuzselimkolbasar avatar Aug 19 '25 22:08 yavuzselimkolbasar