Unverified Commit 17bb7ab2 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

Merge pull request #229355 from aidalgol/heroic-2.7

heroic: 2.6.2 -> 2.7.1
parents 35c8036d f72a90f4
Loading
Loading
Loading
Loading
+31 −7
Original line number Diff line number Diff line
{ lib
, gitUpdater
, writeScript
, buildPythonApplication
, fetchFromGitHub
, pythonOlder
, setuptools
, requests
, cacert
}:

buildPythonApplication rec {
  pname = "gogdl";
  version = "0.4";
  version = "0.7.1";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "Heroic-Games-Launcher";
    repo = "heroic-gogdl";
    rev = "refs/tags/v${version}";
    sha256 = "sha256-4hWuGd0Alzd/ZqtN4zG2aid6C9lnT3Ihrrsjfg9PEYA=";
    rev = "8bfb965090153c946c616bb0f82e3dc432e0d0e1";
    sha256 = "sha256-ZdPyJk4WPVBtKMTf/AHNpG8QTV2qmpD1DT1D3gK5g2I=";
  };

  disabled = pythonOlder "3.8";
@@ -35,7 +36,30 @@ buildPythonApplication rec {
    maintainers = with maintainers; [ aidalgol ];
  };

  passthru.updateScript = gitUpdater {
    rev-prefix = "v";
  };
  # Upstream no longer 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=Heroic-Games-Launcher
    repo=heroic-gogdl
    path='gogdl/__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/gogdl/default.nix \
      --rev=$commit
  '';
}
+69 −27
Original line number Diff line number Diff line
{ lib
, mkYarnPackage
, stdenv
, fetchFromGitHub
, fetchYarnDeps
, fetchpatch
, gitUpdater
, yarn
, fixup_yarn_lock
, nodejs
, python3
, makeWrapper
, electron
, gogdl
, legendary-gl
}:

mkYarnPackage rec {
let appName = "heroic";
in stdenv.mkDerivation rec {
  pname = "heroic-unwrapped";
  version = "2.6.2";
  version = "2.7.1";

  src = fetchFromGitHub {
    owner = "Heroic-Games-Launcher";
    repo = "HeroicGamesLauncher";
    rev = "v${version}";
    sha256 = "sha256-QXciJkY5l5Oqzgnj9vV5IwOSUtVeLMH29r2EIQVt2LI=";
    sha256 = "sha256-l2eVLn1N+1nGxr8Oa2ecQgBmO0w/VJ8AY06GYQ0HiiI=";
  };

  packageJSON = ./package.json;
  yarnLock = ./yarn.lock;
  yarnNix = ./yarn.nix;
  offlineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    sha256 = "sha256-R0lZrVfUH8NucuwarcE47jQ8ex5FY2hK6jJJ2TIRSWY=";
  };

  patches = [
    # Fix for capturing keyboard shortcuts when not in focus.
    # TODO: Remove when updating past 2.7.1.
    (fetchpatch {
      url = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/commit/c82e6ca8dd7070071793fe5a3c4c04b4ae02c3c7.patch";
      hash = "sha256-Pum67YPejfq8ERv6XWVLQzs+/SyNojmTGTQpE0UR4kg=";
    })
  ];

  nativeBuildInputs = [
    yarn
    fixup_yarn_lock
    nodejs
    python3
    makeWrapper
  ];

  DISABLE_ESLINT_PLUGIN = "true";
  configurePhase = ''
    runHook preConfigure

  postBuild = let
    yarnCmd = "yarn --offline --frozen-lockfile --ignore-engines --ignore-scripts --lockfile ${yarnLock}";
  in ''
    rm deps/heroic/node_modules
    ln -s ../../node_modules deps/heroic/
    ${yarnCmd} vite build
    export HOME=$(mktemp -d)
    yarn config --offline set yarn-offline-mirror $offlineCache
    fixup_yarn_lock yarn.lock
    yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
    patchShebangs node_modules/

    runHook postConfigure
  '';

  # Disable bundling into a tar archive.
  doDist = false;
  buildPhase = ''
    runHook preBuild

    yarn --offline vite build

    # Remove dev dependencies.
    yarn install --production --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive

    runHook postBuild
  '';

  # --disable-gpu-compositing is to work around upstream bug
  # https://github.com/electron/electron/issues/32317
  postInstall = let
    deps = "$out/libexec/heroic/deps/heroic";
  installPhase = let
    binPlatform = if stdenv.isDarwin then "darwin" else "linux";
  in ''
    rm -rf "${deps}/public/bin" "${deps}/build/bin"
    mkdir -p "${deps}/build/bin/linux"
    ln -s "${gogdl}/bin/gogdl" "${legendary-gl}/bin/legendary" "${deps}/build/bin/linux"
    runHook preInstall

    mkdir -p $out/share/{applications,${appName}}
    cp -r . $out/share/${appName}
    rm -rf $out/share/${appName}/{.devcontainer,.vscode,.husky,.idea,.github}

    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}"

    makeWrapper "${electron}/bin/electron" "$out/bin/heroic" \
      --inherit-argv0 \
      --add-flags --disable-gpu-compositing \
      --add-flags "${deps}"
      --add-flags $out/share/${appName} \
      --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"

    substituteInPlace "${deps}/flatpak/com.heroicgameslauncher.hgl.desktop" \
    substituteInPlace "$out/share/${appName}/flatpak/com.heroicgameslauncher.hgl.desktop" \
      --replace "Exec=heroic-run" "Exec=heroic"
    mkdir -p "$out/share/applications" "$out/share/icons/hicolor/512x512/apps"
    ln -s "${deps}/flatpak/com.heroicgameslauncher.hgl.desktop" "$out/share/applications"
    ln -s "${deps}/flatpak/com.heroicgameslauncher.hgl.png" "$out/share/icons/hicolor/512x512/apps"
    ln -s "$out/share/${appName}/flatpak/com.heroicgameslauncher.hgl.desktop" "$out/share/applications"
    ln -s "$out/share/${appName}/flatpak/com.heroicgameslauncher.hgl.png" "$out/share/icons/hicolor/512x512/apps"

    runHook postInstall
  '';

  passthru.updateScript = gitUpdater {
@@ -68,9 +109,10 @@ mkYarnPackage rec {
  meta = with lib; {
    description = "A Native GOG and Epic 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;
    maintainers = with maintainers; [ aidalgol ];
    platforms = [ "x86_64-linux" ];
    mainProgram = "heroic";
    platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
    mainProgram = appName;
  };
}
+0 −1
Original line number Diff line number Diff line
@@ -100,7 +100,6 @@ buildFHSEnv {
    openal
    openldap
    openssl
    openssl_1_1
    pango
    pipewire
    samba4
+85 −60
Original line number Diff line number Diff line
{
  "name": "heroic",
  "version": "2.6.2",
  "version": "2.7.1",
  "private": true,
  "main": "build/electron/main.js",
  "homepage": "./",
@@ -15,8 +15,9 @@
    "email": "heroicgameslauncher@protonmail.com"
  },
  "build": {
    "appId": "com.electron.heroic",
    "appId": "com.heroicgameslauncher.hgl",
    "productName": "Heroic",
    "afterSign": "sign/notarize.js",
    "files": [
      "build/**/*",
      "node_modules/**/*",
@@ -28,7 +29,8 @@
      "build/icon.icns",
      "build/win_icon.ico",
      "build/icon-dark.png",
      "build/icon-light.png"
      "build/icon-light.png",
      "build/webviewPreload.js"
    ],
    "protocols": [
      {
@@ -54,9 +56,13 @@
    },
    "mac": {
      "artifactName": "${productName}-${version}-macOS-${arch}.${ext}",
      "target": "dmg",
      "category": "public.app-category.games",
      "icon": "build/icon.icns",
      "entitlements": "build/entitlements.mac.plist",
      "entitlementsInherit": "build/entitlements.mac.plist",
      "extendInfo": {
        "com.apple.security.cs.allow-jit": true
      },
      "asarUnpack": [
        "build/bin/darwin/legendary",
        "build/bin/darwin/gogdl"
@@ -118,54 +124,66 @@
      "depends": [
        "curl"
      ]
    },
    "snap": {
      "allowNativeWayland": true,
      "category": "Games",
      "synopsis": "An Open Source Launcher for GOG and Epic Games",
      "description": "Heroic is an Open Source Games Launcher. Right now it supports launching games from the Epic Games Store using Legendary and GOG Games using our custom implementation with gogdl.",
      "publish": {
        "provider": "snapStore",
        "channels": [
          "edge"
        ],
        "repo": "heroic"
      }
    }
  },
  "dependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@fontsource/cabin": "^4.5.5",
    "@fontsource/rubik": "^4.5.6",
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@fortawesome/free-brands-svg-icons": "^6.1.1",
    "@fortawesome/free-regular-svg-icons": "^6.1.1",
    "@fortawesome/free-solid-svg-icons": "^6.1.1",
    "@fortawesome/react-fontawesome": "^0.1.18",
    "@mui/icons-material": "^5.10.9",
    "@mui/material": "^5.10.12",
    "@emotion/react": "^11.10.6",
    "@emotion/styled": "^11.10.6",
    "@fontsource/cabin": "^4.5.10",
    "@fontsource/rubik": "^4.5.14",
    "@fortawesome/fontawesome-svg-core": "^6.3.0",
    "@fortawesome/free-brands-svg-icons": "^6.3.0",
    "@fortawesome/free-regular-svg-icons": "^6.3.0",
    "@fortawesome/free-solid-svg-icons": "^6.3.0",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@mui/icons-material": "^5.11.11",
    "@mui/material": "^5.11.12",
    "@node-steam/vdf": "^2.2.0",
    "@shockpkg/icon-encoder": "^2.1.3",
    "axios": "^0.26.1",
    "check-disk-space": "^3.3.1",
    "classnames": "^2.3.1",
    "crc": "^4.1.1",
    "crc": "^4.3.2",
    "discord-rich-presence-typescript": "^0.0.8",
    "electron-store": "^8.0.1",
    "electron-updater": "^5.0.1",
    "filesize": "^8.0.7",
    "filesize": "^10.0.6",
    "font-list": "^1.4.5",
    "fs-extra": "^10.1.0",
    "fs-extra": "^11.1.0",
    "fuse.js": "^6.6.2",
    "graceful-fs": "^4.2.10",
    "howlongtobeat": "^1.7.0",
    "i18next": "^21.6.16",
    "i18next-fs-backend": "^1.1.4",
    "i18next-http-backend": "^1.4.0",
    "i18next": "^22.4.11",
    "i18next-fs-backend": "^2.1.1",
    "i18next-http-backend": "^2.1.1",
    "ini": "^3.0.0",
    "plist": "^3.0.5",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-i18next": "^11.16.7",
    "react-markdown": "^8.0.3",
    "react-router-dom": "^6.3.0",
    "recharts": "^2.1.14",
    "react-i18next": "^12.2.0",
    "react-markdown": "^8.0.5",
    "react-router-dom": "^6.9.0",
    "recharts": "^2.4.3",
    "sanitize-filename": "^1.6.3",
    "shlex": "^2.1.2",
    "short-uuid": "^4.2.0",
    "simple-keyboard": "^3.4.136",
    "source-map-support": "^0.5.21",
    "short-uuid": "^4.2.2",
    "simple-keyboard": "^3.5.33",
    "steam-shortcut-editor": "^3.1.1",
    "systeminformation": "^5.15.0",
    "ts-prune": "^0.10.3",
    "tslib": "^2.4.0"
    "systeminformation": "^5.17.12",
    "tslib": "^2.5.0"
  },
  "scripts": {
    "start": "vite",
@@ -174,19 +192,20 @@
    "test": "jest",
    "test-watch": "jest --watch --maxWorkers=25%",
    "test:ci": "jest --runInBand --silent",
    "release:linux": "vite build && electron-builder -p always --linux deb AppImage rpm pacman tar.xz",
    "release:linux": "vite build && electron-builder -p always --linux deb AppImage rpm pacman tar.xz snap",
    "release:mac": "vite build && electron-builder -p always --mac --x64 --arm64",
    "release:win": "vite build && electron-builder -p never --win nsis portable --x64 --arm64",
    "release:win": "vite build && electron-builder -p always --win portable --x64 --arm64",
    "sign:win": "vite build && electron-builder -p never --win nsis --x64 --arm64",
    "dist:linux": "vite build && electron-builder --linux",
    "dist:mac": "vite build && electron-builder --mac",
    "dist:mac": "export CSC_IDENTITY_AUTO_DISCOVERY=false && vite build && electron-builder --mac",
    "dist:win": "vite build && electron-builder --win",
    "dist:flatpak": "yarn dist:linux appimage && yarn flatpak:prepare && yarn flatpak:build",
    "lint": "eslint --cache -c .eslintrc --ext .tsx,ts ./src",
    "lint": "eslint --cache -c .eslintrc --ext .tsx,ts .",
    "lint-fix": "eslint --fix -c .eslintrc --ext .tsx,ts ./src",
    "flatpak:build": "cd flatpak-build && flatpak-builder build com.heroicgameslauncher.hgl.yml --install --force-clean --user",
    "flatpak:prepare": "node ./flatpak/prepareFlatpak.js",
    "flatpak:prepare-release": "node ./flatpak/prepareFlatpak.js release",
    "i18n": "i18next",
    "i18n": "i18next --silent",
    "prepare": "husky install",
    "prettier": "prettier --check . '!flatpak-build'",
    "prettier-fix": "prettier --write . '!flatpak-build'"
@@ -198,42 +217,48 @@
    ]
  },
  "devDependencies": {
    "@testing-library/dom": "^7.31.0",
    "@electron/notarize": "^1.2.3",
    "@testing-library/dom": "^9.0.1",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.1.1",
    "@testing-library/react": "^14.0.0",
    "@testing-library/user-event": "^14.1.1",
    "@types/classnames": "^2.3.1",
    "@types/i18next-fs-backend": "^1.1.2",
    "@types/ini": "^1.3.31",
    "@types/jest": "^27.4.1",
    "@types/node": "^17.0.25",
    "@types/jest": "^29.4.0",
    "@types/node": "^18.15.0",
    "@types/plist": "^3.0.2",
    "@types/react": "^18.0.24",
    "@types/react-dom": "^18.0.8",
    "@types/react": "^18.0.28",
    "@types/react-dom": "^18.0.11",
    "@types/react-router-dom": "^5.3.3",
    "@types/tmp": "^0.2.3",
    "@typescript-eslint/eslint-plugin": "^5.20.0",
    "@typescript-eslint/parser": "^5.20.0",
    "@vitejs/plugin-react": "^2.2.0",
    "electron": "^22.2.0",
    "@typescript-eslint/eslint-plugin": "^5.47.1",
    "@typescript-eslint/parser": "^5.47.1",
    "@vitejs/plugin-react-swc": "^3.2.0",
    "electron": "^23.1.3",
    "electron-builder": "^23.6.0",
    "electron-devtools-installer": "^3.2.0",
    "eslint": "^8.13.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-react": "^7.29.4",
    "husky": "^7.0.4",
    "i18next-parser": "^6.3.0",
    "jest": "^28.1.3",
    "prettier": "^2.6.2",
    "eslint": "^8.36.0",
    "eslint-config-prettier": "^8.7.0",
    "eslint-plugin-import": "^2.27.5",
    "eslint-plugin-react": "^7.31.11",
    "husky": "^8.0.3",
    "i18next-parser": "^7.7.0",
    "jest": "^29.5.0",
    "prettier": "^2.8.1",
    "pretty-quick": "^3.1.3",
    "sass": "^1.55.0",
    "sass": "^1.59.2",
    "tmp": "^0.2.1",
    "ts-jest": "^28.0.7",
    "type-fest": "^3.2.0",
    "typescript": "^4.8.4",
    "vite": "^3.2.2",
    "ts-jest": "^29.0.5",
    "ts-prune": "^0.10.3",
    "type-fest": "^3.6.1",
    "typescript": "^4.9.4",
    "unimported": "^1.26.0",
    "vite": "^3.2.5",
    "vite-plugin-electron": "^0.10.2",
    "vite-plugin-svgr": "^2.2.2"
    "vite-plugin-svgr": "^2.4.0"
  },
  "resolutions": {
    "ts-morph": "^17.0.1"
  }
}
+2171 −1442

File changed.

Preview size limit exceeded, changes collapsed.

Loading