diff --git a/pkgs/by-name/co/comet-gog/package.nix b/pkgs/by-name/co/comet-gog/package.nix index f02b6a61c78e..171026bbb31e 100644 --- a/pkgs/by-name/co/comet-gog/package.nix +++ b/pkgs/by-name/co/comet-gog/package.nix @@ -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 + ]; }; -} +}) diff --git a/pkgs/by-name/he/heroic-unwrapped/epic-integration.nix b/pkgs/by-name/he/heroic-unwrapped/epic-integration.nix new file mode 100644 index 000000000000..d025a13a1b99 --- /dev/null +++ b/pkgs/by-name/he/heroic-unwrapped/epic-integration.nix @@ -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 { }; +}) diff --git a/pkgs/by-name/le/legendary-heroic/package.nix b/pkgs/by-name/he/heroic-unwrapped/legendary.nix similarity index 100% rename from pkgs/by-name/le/legendary-heroic/package.nix rename to pkgs/by-name/he/heroic-unwrapped/legendary.nix diff --git a/pkgs/by-name/he/heroic-unwrapped/package.nix b/pkgs/by-name/he/heroic-unwrapped/package.nix index 90786b9fbf5c..5eb4256f3d3a 100644 --- a/pkgs/by-name/he/heroic-unwrapped/package.nix +++ b/pkgs/by-name/he/heroic-unwrapped/package.nix @@ -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. diff --git a/pkgs/by-name/he/heroic-unwrapped/pr-4885.patch b/pkgs/by-name/he/heroic-unwrapped/pr-4885.patch new file mode 100644 index 000000000000..96d71ae63f42 --- /dev/null +++ b/pkgs/by-name/he/heroic-unwrapped/pr-4885.patch @@ -0,0 +1,71 @@ +From a98cc23b288e13665c8698eec56e0653613946d7 Mon Sep 17 00:00:00 2001 +From: Aidan Gauland +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' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a387dd07aafe..49d6307bd104 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {