diff --git a/pkgs/games/gogdl/default.nix b/pkgs/games/gogdl/default.nix index 346d5f81459a..a6b41e7bd645 100644 --- a/pkgs/games/gogdl/default.nix +++ b/pkgs/games/gogdl/default.nix @@ -1,4 +1,5 @@ { lib +, fetchpatch , writeScript , buildPythonApplication , fetchFromGitHub @@ -10,14 +11,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"; @@ -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; { diff --git a/pkgs/games/heroic/default.nix b/pkgs/games/heroic/default.nix index 1baf9cbf8163..05455ae7c7d6 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 = [ @@ -37,6 +38,14 @@ 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 + # Make Heroic create Steam shortcuts (to non-steam games) with the correct path to heroic. + ./fix-non-steam-shortcuts.patch + ]; + configurePhase = '' runHook preConfigure @@ -74,7 +83,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 +105,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; 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) { 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 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"; 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 c0611ef642a4..9b212a884c4c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37916,6 +37916,8 @@ with pkgs; nexuiz = callPackage ../games/nexuiz { }; + nile = python3Packages.callPackage ../games/nile { }; + ninvaders = callPackage ../games/ninvaders { }; njam = callPackage ../games/njam { };