Heroic: fix helper programs (#432183)

This commit is contained in:
Sandro
2025-08-27 16:36:21 +02:00
committed by GitHub
6 changed files with 200 additions and 19 deletions
+60 -11
View File
@@ -1,37 +1,86 @@
{
comet-gog_kind ? "latest",
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
protobuf,
buildPackages,
meson,
ninja,
pkgsCross,
}:
rustPlatform.buildRustPackage rec {
let
versionInfoTable = {
"latest" = {
version = "0.3.1";
srcHash = "sha256-asg2xp9A5abmsF+CgOa+ScK2sQwSNFQXD5Qnm76Iyhg=";
cargoHash = "sha256-K0lQuk2PBwnVlkRpYNo4Z7to/Lx2fY6RIlkgmMjvEtc=";
};
# version pin that is compatible with heroic
"heroic" = {
version = "0.2.0";
srcHash = "sha256-LAEt2i/SRABrz+y2CTMudrugifLgHNxkMSdC8PXYF0E=";
cargoHash = "sha256-SvDE+QqaSK0+4XgB3bdmqOtwxBDTlf7yckTR8XjmMXc=";
};
};
versionInfo = versionInfoTable.${comet-gog_kind};
in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "comet-gog";
version = "0.3.1";
inherit (versionInfo) version cargoHash;
src = fetchFromGitHub {
owner = "imLinguin";
repo = "comet";
tag = "v${version}";
hash = "sha256-asg2xp9A5abmsF+CgOa+ScK2sQwSNFQXD5Qnm76Iyhg=";
tag = "v${finalAttrs.version}";
hash = versionInfo.srcHash;
fetchSubmodules = true;
};
cargoHash = "sha256-K0lQuk2PBwnVlkRpYNo4Z7to/Lx2fY6RIlkgmMjvEtc=";
# error: linker `aarch64-linux-gnu-gcc` not found
postPatch = ''
rm .cargo/config.toml
'';
env.PROTOC = lib.getExe' protobuf "protoc";
# TECHNICALLY, we could remove this, but then we'd be using the vendored precompiled protoc binary...
env.PROTOC = lib.getExe' buildPackages.protobuf "protoc";
passthru.dummy-service = stdenv.mkDerivation {
pname = "galaxy-dummy-service";
inherit (finalAttrs) version src;
sourceRoot = "${finalAttrs.src.name}/dummy-service";
nativeBuildInputs = [
meson
ninja
pkgsCross.mingwW64.buildPackages.gcc
];
mesonFlags = [
"--cross-file meson/x86_64-w64-mingw32.ini"
];
installPhase = ''
runHook preInstall
install -D GalaxyCommunication.exe -t "$out"/
runHook postInstall
'';
};
meta = {
changelog = "https://github.com/imLinguin/comet/releases/tag/v${version}";
changelog = "https://github.com/imLinguin/comet/releases/tag/${finalAttrs.src.tag}";
description = "Open Source implementation of GOG Galaxy's Communication Service";
homepage = "https://github.com/imLinguin/comet";
license = lib.licenses.gpl3Plus;
mainProgram = "comet";
maintainers = with lib.maintainers; [ tomasajt ];
maintainers = with lib.maintainers; [
tomasajt
aidalgol
];
};
}
})
@@ -0,0 +1,49 @@
{
lib,
stdenv,
gitUpdater,
fetchFromGitHub,
cmake,
pkgsCross,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "heroic-epic-integration";
version = "0.3";
src = fetchFromGitHub {
owner = "Etaash-mathamsetty";
repo = "heroic-epic-integration";
tag = "v${finalAttrs.version}";
hash = "sha256-Zn0MsaQd8Ro6eu8IQkMcLNGLVTUukwajkn8PRLfB+Yw=";
};
nativeBuildInputs = [
cmake
pkgsCross.mingwW64.buildPackages.gcc
];
cmakeFlags = [ (lib.cmakeFeature "CMAKE_TOOLCHAIN_FILE" "../windows.cmake") ];
installPhase = ''
runHook preInstall
mkdir $out
cp heroic-epic-integration.exe $out/EpicGamesLauncher.exe
runHook postInstall
'';
meta = {
description = "Wrapper process for games launched through Heroic Games Launcher";
longDescription = ''
This is a Windows executable that pretends to be EpicGamesLauncher.exe for
games that expect it to be their parent process.
'';
homepage = "https://github.com/Etaash-mathamsetty/heroic-epic-integration";
changelog = "https://github.com/Etaash-mathamsetty/heroic-epic-integration/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ aidalgol ];
};
passthru.updateScript = gitUpdater { };
})
+18 -8
View File
@@ -1,8 +1,8 @@
{
lib,
callPackage,
stdenv,
fetchFromGitHub,
nix-update-script,
# Pinned, because our FODs are not guaranteed to be stable between major versions.
pnpm_10,
nodejs,
@@ -12,13 +12,15 @@
electron_36,
vulkan-helper,
gogdl,
legendary-heroic,
nile,
comet-gog,
comet-gog_heroic,
umu-launcher,
}:
let
legendary = callPackage ./legendary.nix { };
epic-integration = callPackage ./epic-integration.nix { };
comet-gog = comet-gog_heroic;
electron = electron_36;
in
stdenv.mkDerivation (finalAttrs: {
@@ -48,6 +50,8 @@ stdenv.mkDerivation (finalAttrs: {
patches = [
# Make Heroic create Steam shortcuts (to non-steam games) with the correct path to heroic.
./fix-non-steam-shortcuts.patch
# Fixes incorrect path to GalaxyCommunication.exe
./pr-4885.patch
];
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
@@ -79,14 +83,21 @@ stdenv.mkDerivation (finalAttrs: {
cp -r public "$out/opt/heroic/resources/app.asar.unpacked/build"
rm -rf "$out/opt/heroic/resources/app.asar.unpacked/build/bin"
mkdir -p "$out/opt/heroic/resources/app.asar.unpacked/build/bin/x64/linux"
mkdir -p \
"$out/opt/heroic/resources/app.asar.unpacked/build/bin/x64/linux" \
"$out/opt/heroic/resources/app.asar.unpacked/build/bin/x64/win32"
ln -s \
"${lib.getExe gogdl}" \
"${lib.getExe legendary-heroic}" \
"${lib.getExe legendary}" \
"${lib.getExe nile}" \
"${lib.getExe comet-gog}" \
"${lib.getExe vulkan-helper}" \
"$out/opt/heroic/resources/app.asar.unpacked/build/bin/x64/linux"
# Don't symlink these so we don't confuse Windows applications under Wine/Proton.
cp \
"${comet-gog.dummy-service}/GalaxyCommunication.exe" \
"${epic-integration}/EpicGamesLauncher.exe" \
"$out/opt/heroic/resources/app.asar.unpacked/build/bin/x64/win32"
makeWrapper "${electron}/bin/electron" "$out/bin/heroic" \
--inherit-argv0 \
@@ -105,14 +116,13 @@ stdenv.mkDerivation (finalAttrs: {
'';
passthru = {
inherit (finalAttrs) pnpmDeps;
updateScript = nix-update-script { };
inherit epic-integration legendary;
};
meta = with lib; {
description = "Native GOG, Epic, and Amazon Games Launcher for Linux, Windows and Mac";
homepage = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher";
changelog = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases";
changelog = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/tag/v${finalAttrs.version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ aidalgol ];
# Heroic may work on nix-darwin, but it needs a dedicated maintainer for the platform.
@@ -0,0 +1,71 @@
From a98cc23b288e13665c8698eec56e0653613946d7 Mon Sep 17 00:00:00 2001
From: Aidan Gauland <aidalgol@fastmail.net>
Date: Tue, 19 Aug 2025 09:45:55 +1200
Subject: [PATCH] [Fix] Run GalaxyComm executable path through fixAsarPath
---
src/backend/constants/paths.ts | 4 ++++
src/backend/launcher.ts | 15 +++++----------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/backend/constants/paths.ts b/src/backend/constants/paths.ts
index 1d05ce5b58..2e9cff1197 100644
--- a/src/backend/constants/paths.ts
+++ b/src/backend/constants/paths.ts
@@ -44,6 +44,10 @@ export const fakeEpicExePath = fixAsarPath(
join(publicDir, 'bin', 'x64', 'win32', 'EpicGamesLauncher.exe')
)
+export const galaxyCommunicationExePath = fixAsarPath(
+ join(publicDir, 'bin', 'x64', 'win32', 'GalaxyCommunication.exe')
+)
+
export const webviewPreloadPath = fixAsarPath(
join('file://', publicDir, 'webviewPreload.js')
)
diff --git a/src/backend/launcher.ts b/src/backend/launcher.ts
index a239cff927..2262dc35b2 100644
--- a/src/backend/launcher.ts
+++ b/src/backend/launcher.ts
@@ -80,7 +80,7 @@ import {
defaultWinePrefix,
fixesPath,
flatpakHome,
- publicDir,
+ galaxyCommunicationExePath,
runtimePath,
userHome
} from './constants/paths'
@@ -888,28 +888,23 @@ async function prepareWineLaunch(
try {
if (runner === 'gog' && experimentalFeatures?.cometSupport !== false) {
- const communicationSource = join(
- publicDir,
- 'bin/x64/win32/GalaxyCommunication.exe'
- )
-
- const galaxyCommPath =
+ const galaxyCommWinePath =
'C:\\ProgramData\\GOG.com\\Galaxy\\redists\\GalaxyCommunication.exe'
const communicationDest = await getWinePath({
- path: galaxyCommPath,
+ path: galaxyCommWinePath,
gameSettings,
variant: 'unix'
})
if (!existsSync(communicationDest)) {
mkdirSync(dirname(communicationDest), { recursive: true })
- await copyFile(communicationSource, communicationDest)
+ await copyFile(galaxyCommunicationExePath, communicationDest)
await runWineCommand({
commandParts: [
'sc',
'create',
'GalaxyCommunication',
- `binpath=${galaxyCommPath}`
+ `binpath=${galaxyCommWinePath}`
],
gameSettings,
protonVerb: 'runinprefix'
+2
View File
@@ -2622,6 +2622,8 @@ with pkgs;
cocoapods-beta = lowPrio (callPackage ../development/tools/cocoapods { beta = true; });
comet-gog_heroic = callPackage ../by-name/co/comet-gog/package.nix { comet-gog_kind = "heroic"; };
compass = callPackage ../development/tools/compass { };
cone = callPackage ../development/compilers/cone {