From 893ae858d584f7e820e76acab83feac06d1b917a Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Mon, 31 Jul 2023 14:43:04 +1200 Subject: [PATCH 1/7] gogdl: 0.7.2 -> 0.7.3 --- pkgs/games/gogdl/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/games/gogdl/default.nix b/pkgs/games/gogdl/default.nix index 346d5f81459a..97bce673a80f 100644 --- a/pkgs/games/gogdl/default.nix +++ b/pkgs/games/gogdl/default.nix @@ -10,14 +10,14 @@ buildPythonApplication rec { pname = "gogdl"; - version = "0.7.2"; + version = "0.7.3"; format = "pyproject"; src = fetchFromGitHub { owner = "Heroic-Games-Launcher"; repo = "heroic-gogdl"; - rev = "d7f29dfef5818e8b323d04761e18a9abb750f93e"; - hash = "sha256-9dAenawt9h/sz5paVYoqk+nmzPrInlqyh1EgshI25CE="; + rev = "d2fa34bfba7beb2ecc0e3fc70a657f2c612c8a10"; + hash = "sha256-YCqtfY49lDg6sLrF/INOZVD9cMCwvejhySzUWrxHKAw="; }; disabled = pythonOlder "3.8"; From 5a29bee734c4df3789970a988d7d163b220c83b0 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Mon, 31 Jul 2023 14:45:35 +1200 Subject: [PATCH 2/7] legendary-gl: 0.20.32 -> 0.20.33 --- pkgs/games/legendary-gl/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/games/legendary-gl/default.nix b/pkgs/games/legendary-gl/default.nix index a863b1d1cee7..569148f2cf50 100644 --- a/pkgs/games/legendary-gl/default.nix +++ b/pkgs/games/legendary-gl/default.nix @@ -4,20 +4,24 @@ , buildPythonApplication , pythonOlder , requests +, filelock }: buildPythonApplication rec { pname = "legendary-gl"; # Name in pypi - version = "0.20.32"; + version = "0.20.33"; src = fetchFromGitHub { owner = "derrod"; repo = "legendary"; rev = "refs/tags/${version}"; - sha256 = "sha256-MsvhVS3lqhgBJ+S/cjXFP70I3rM5WBYT7TyVlRWhNWw="; + sha256 = "sha256-fEQUChkxrKV2IkFGORUolZE2qTzA10Xxogjl5Va4TcE="; }; - propagatedBuildInputs = [ requests ]; + propagatedBuildInputs = [ + requests + filelock + ]; disabled = pythonOlder "3.8"; From 4d5658d7bd41b4d4fa5dbc2b2992dba58dc37cdf Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Tue, 1 Aug 2023 11:07:46 +1200 Subject: [PATCH 3/7] nile: init at 1.0.0 --- pkgs/games/nile/default.nix | 84 +++++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 86 insertions(+) create mode 100644 pkgs/games/nile/default.nix diff --git a/pkgs/games/nile/default.nix b/pkgs/games/nile/default.nix new file mode 100644 index 000000000000..beb444ae11ec --- /dev/null +++ b/pkgs/games/nile/default.nix @@ -0,0 +1,84 @@ +{ lib +, writeScript +, buildPythonApplication +, fetchFromGitHub +, pythonOlder +, setuptools +, requests +, protobuf +, pycryptodome +, zstandard +, json5 +, platformdirs +, cacert +}: + +buildPythonApplication rec { + pname = "nile"; + version = "1.0.0"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "imLinguin"; + repo = "nile"; + rev = "f5f3b96f6483c59cfc646afbda6e97cb0bd94778"; + hash = "sha256-HibY3U9/MibEDwHY+YiErW/pz6qwtps8wwjhznTISgA="; + }; + + disabled = pythonOlder "3.8"; + + propagatedBuildInputs = [ + setuptools + requests + protobuf + pycryptodome + zstandard + json5 + platformdirs + ]; + + pyprojectAppendix = '' + [tool.setuptools.packages.find] + include = ["nile*"] + ''; + + postPatch = '' + echo "$pyprojectAppendix" >> pyproject.toml + ''; + + pythonImportsCheck = [ "nile" ]; + + meta = with lib; { + description = "Unofficial Amazon Games client"; + homepage = "https://github.com/imLinguin/nile"; + license = with licenses; [ gpl3 ]; + maintainers = with maintainers; [ aidalgol ]; + }; + + # Upstream does not create git tags when bumping the version, so we have to + # extract it from the source code on the main branch. + passthru.updateScript = writeScript "gogdl-update-script" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl gnused jq common-updater-scripts + set -eou pipefail; + + owner=imLinguin + repo=nile + path='nile/__init__.py' + + version=$( + curl --cacert "${cacert}/etc/ssl/certs/ca-bundle.crt" \ + https://raw.githubusercontent.com/$owner/$repo/main/$path | + sed -n 's/^\s*version\s*=\s*"\([0-9]\.[0-9]\.[0-9]\)"\s*$/\1/p') + + commit=$(curl --cacert "${cacert}/etc/ssl/certs/ca-bundle.crt" \ + https://api.github.com/repos/$owner/$repo/commits?path=$path | + jq -r '.[0].sha') + + update-source-version \ + ${pname} \ + "$version" \ + --file=./pkgs/games/nile/default.nix \ + --rev=$commit + ''; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 877a88a0ff10..45d23ae6da23 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37600,6 +37600,8 @@ with pkgs; nexuiz = callPackage ../games/nexuiz { }; + nile = python3Packages.callPackage ../games/nile { }; + ninvaders = callPackage ../games/ninvaders { }; njam = callPackage ../games/njam { }; From 0e012f05c757c66d8d8f03bb165028afd1b2cc12 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Mon, 31 Jul 2023 15:05:58 +1200 Subject: [PATCH 4/7] heroic: 2.8.0 -> 2.9.1 Now also depends upon nile. --- pkgs/games/heroic/default.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/games/heroic/default.nix b/pkgs/games/heroic/default.nix index 1baf9cbf8163..94ca8329ffdd 100644 --- a/pkgs/games/heroic/default.nix +++ b/pkgs/games/heroic/default.nix @@ -10,23 +10,24 @@ , electron , gogdl , legendary-gl +, nile }: let appName = "heroic"; in stdenv.mkDerivation rec { pname = "heroic-unwrapped"; - version = "2.8.0"; + version = "2.9.1"; src = fetchFromGitHub { owner = "Heroic-Games-Launcher"; repo = "HeroicGamesLauncher"; rev = "v${version}"; - hash = "sha256-AZwJRBkWuzBPT+ADVHabiK2KRXe6clZFa0IO99BO2Wk="; + hash = "sha256-1FtAcp6cG2qRfWrAgCOQ87DzMvszqqhObfSzepezBGc="; }; offlineCache = fetchYarnDeps { yarnLock = "${src}/yarn.lock"; - hash = "sha256-xiLK0D9+oL2UMD7b/9htOQJEpYCNayKW+KJ/vNVCgsw="; + hash = "sha256-KEzTjtoBcHNJxC/7W/Bft75JZuZUSHieOOAwhbr5d3s="; }; nativeBuildInputs = [ @@ -74,7 +75,11 @@ in stdenv.mkDerivation rec { chmod -R u+w "$out/share/${appName}/public/bin" "$out/share/${appName}/build/bin" rm -rf "$out/share/${appName}/public/bin" "$out/share/${appName}/build/bin" mkdir -p "$out/share/${appName}/build/bin/${binPlatform}" - ln -s "${gogdl}/bin/gogdl" "${legendary-gl}/bin/legendary" "$out/share/${appName}/build/bin/${binPlatform}" + ln -s \ + "${gogdl}/bin/gogdl" \ + "${legendary-gl}/bin/legendary" \ + "${nile}"/bin/nile \ + "$out/share/${appName}/build/bin/${binPlatform}" makeWrapper "${electron}/bin/electron" "$out/bin/heroic" \ --inherit-argv0 \ @@ -92,7 +97,7 @@ in stdenv.mkDerivation rec { ''; meta = with lib; { - description = "A Native GOG and Epic Games Launcher for Linux, Windows and Mac"; + description = "A 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"; license = licenses.gpl3Only; From 80701428e9e7819c5dc3cb2be40afc670386e769 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Tue, 1 Aug 2023 16:31:19 +1200 Subject: [PATCH 5/7] heroic: patch out DRM support DRM support added in 2.9.0 prevent Heroic from running at all under mainline Electron, instead requiring running against a non-free fork with DRM support compiled in. --- pkgs/games/heroic/default.nix | 6 ++++++ pkgs/games/heroic/remove-drm-support.patch | 24 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/games/heroic/remove-drm-support.patch diff --git a/pkgs/games/heroic/default.nix b/pkgs/games/heroic/default.nix index 94ca8329ffdd..6ebd911ccdc3 100644 --- a/pkgs/games/heroic/default.nix +++ b/pkgs/games/heroic/default.nix @@ -38,6 +38,12 @@ in stdenv.mkDerivation rec { makeWrapper ]; + patches = [ + # Reverts part of upstream PR 2761 so that we don't have to use a non-free Electron fork. + # https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/pull/2761 + ./remove-drm-support.patch + ]; + configurePhase = '' runHook preConfigure diff --git a/pkgs/games/heroic/remove-drm-support.patch b/pkgs/games/heroic/remove-drm-support.patch new file mode 100644 index 000000000000..f3cd80f003f3 --- /dev/null +++ b/pkgs/games/heroic/remove-drm-support.patch @@ -0,0 +1,24 @@ +diff --git a/src/backend/main.ts b/src/backend/main.ts +index 2cd1a28f..a60e04d0 100644 +--- a/src/backend/main.ts ++++ b/src/backend/main.ts +@@ -19,8 +19,7 @@ import { + powerSaveBlocker, + protocol, + screen, +- clipboard, +- components ++ clipboard + } from 'electron' + import 'backend/updater' + import { autoUpdater } from 'electron-updater' +@@ -286,8 +285,7 @@ if (!gotTheLock) { + initImagesCache() + + if (!process.env.CI) { +- await components.whenReady() +- logInfo(['DRM module staus', components.status()]) ++ logInfo('DRM modules disabled for nixpkgs') + } + + // try to fix notification app name on windows From 4523c65f95093a267ffe545a4be67a0d8773e0d5 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Thu, 3 Aug 2023 23:45:55 +1200 Subject: [PATCH 6/7] gogdl: apply upstream PR patch for timeouts issue --- pkgs/games/gogdl/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/games/gogdl/default.nix b/pkgs/games/gogdl/default.nix index 97bce673a80f..a6b41e7bd645 100644 --- a/pkgs/games/gogdl/default.nix +++ b/pkgs/games/gogdl/default.nix @@ -1,4 +1,5 @@ { lib +, fetchpatch , writeScript , buildPythonApplication , fetchFromGitHub @@ -27,6 +28,13 @@ buildPythonApplication rec { requests ]; + patches = [ + (fetchpatch { + url = "https://patch-diff.githubusercontent.com/raw/Heroic-Games-Launcher/heroic-gogdl/pull/37.patch"; + hash = "sha256-oZLetPoWzsEDrL0Bh89HB4hTn70FTh8aXj9mKGr4Dqw="; + }) + ]; + pythonImportsCheck = [ "gogdl" ]; meta = with lib; { From f8fa19a5da5f1f761c4ac924bfde796af990f9da Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sat, 19 Aug 2023 08:06:17 +1200 Subject: [PATCH 7/7] heroic: apply patch to fix Steam shortcuts --- pkgs/games/heroic/default.nix | 2 ++ pkgs/games/heroic/fix-non-steam-shortcuts.patch | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 pkgs/games/heroic/fix-non-steam-shortcuts.patch diff --git a/pkgs/games/heroic/default.nix b/pkgs/games/heroic/default.nix index 6ebd911ccdc3..05455ae7c7d6 100644 --- a/pkgs/games/heroic/default.nix +++ b/pkgs/games/heroic/default.nix @@ -42,6 +42,8 @@ in stdenv.mkDerivation rec { # Reverts part of upstream PR 2761 so that we don't have to use a non-free Electron fork. # https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/pull/2761 ./remove-drm-support.patch + # Make Heroic create Steam shortcuts (to non-steam games) with the correct path to heroic. + ./fix-non-steam-shortcuts.patch ]; configurePhase = '' diff --git a/pkgs/games/heroic/fix-non-steam-shortcuts.patch b/pkgs/games/heroic/fix-non-steam-shortcuts.patch new file mode 100644 index 000000000000..7b46473245f7 --- /dev/null +++ b/pkgs/games/heroic/fix-non-steam-shortcuts.patch @@ -0,0 +1,13 @@ +diff --git a/src/backend/shortcuts/nonesteamgame/nonesteamgame.ts b/src/backend/shortcuts/nonesteamgame/nonesteamgame.ts +index ebef6aa4..c8bd853d 100644 +--- a/src/backend/shortcuts/nonesteamgame/nonesteamgame.ts ++++ b/src/backend/shortcuts/nonesteamgame/nonesteamgame.ts +@@ -252,7 +252,7 @@ async function addNonSteamGame(props: { + // add new Entry + const newEntry = {} as ShortcutEntry + newEntry.AppName = props.gameInfo.title +- newEntry.Exe = `"${app.getPath('exe')}"` ++ newEntry.Exe = `"heroic"` + newEntry.StartDir = `"${process.cwd()}"` + + if (isFlatpak) {