forked from mirrors/nixpkgs
heroic: Repackage from source and wrap in FHS
* Instead of using the prebuilt AppImage, build from source and wrap with Electron from nixpkgs. * Wrap in FHS user environment with buildFHSUserEnvBubblewrap. * Correct meta.description to mention GOG support. * Simplify meta attribute * Update maintainers. Taking over sole maintainership from wolfanguakang. * Use gogdl and legendary-gl from nixpkgs
This commit is contained in:
parent
d63d265c4e
commit
1abe038db9
|
@ -1,39 +1,70 @@
|
|||
{ lib, fetchurl, appimageTools }:
|
||||
{ lib
|
||||
, mkYarnPackage
|
||||
, fetchFromGitHub
|
||||
, makeWrapper
|
||||
, electron
|
||||
, gogdl
|
||||
, legendary-gl
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "heroic";
|
||||
version = "2.2.6";
|
||||
name = "${pname}-${version}";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/download/v${version}/Heroic-${version}.AppImage";
|
||||
sha256 = "sha256-kL30/G4DpDPwGN7PvbWest7TcgL4Rd1c2OM4nRCT3bg=";
|
||||
mkYarnPackage rec {
|
||||
pname = "heroic-unwrapped";
|
||||
version = "2.4.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Heroic-Games-Launcher";
|
||||
repo = "HeroicGamesLauncher";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-x9zIM2kKi+JgIGIidQYjyjqVGweFJ8DE7IX9gYULQuQ=";
|
||||
};
|
||||
appimageContents = appimageTools.extractType2 { inherit name src; };
|
||||
|
||||
in
|
||||
appimageTools.wrapType2 {
|
||||
inherit name src;
|
||||
packageJSON = ./package.json;
|
||||
yarnLock = ./yarn.lock;
|
||||
yarnNix = ./yarn.nix;
|
||||
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/${name} $out/bin/${pname}
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
mkdir -p $out/share/${pname}
|
||||
cp -a ${appimageContents}/locales $out/share/${pname}
|
||||
cp -a ${appimageContents}/resources $out/share/${pname}
|
||||
DISABLE_ESLINT_PLUGIN = "true";
|
||||
|
||||
install -m 444 -D ${appimageContents}/heroic.desktop -t $out/share/applications
|
||||
postBuild = let
|
||||
yarnCmd = "yarn --production --offline --frozen-lockfile --ignore-engines --ignore-scripts --lockfile ${yarnLock}";
|
||||
in ''
|
||||
${yarnCmd} build-electron
|
||||
${yarnCmd} build
|
||||
'';
|
||||
|
||||
cp -a ${appimageContents}/usr/share/icons $out/share/
|
||||
# Disable bundling into a tar archive.
|
||||
doDist = false;
|
||||
|
||||
substituteInPlace $out/share/applications/heroic.desktop \
|
||||
--replace 'Exec=AppRun' 'Exec=heroic'
|
||||
# --disable-gpu-compositing is to work around upstream bug
|
||||
# https://github.com/electron/electron/issues/32317
|
||||
postInstall = let
|
||||
deps = "$out/libexec/heroic/deps/heroic";
|
||||
in ''
|
||||
rm -rf "${deps}/public/bin" "${deps}/build/bin"
|
||||
mkdir -p "${deps}/public/bin/linux"
|
||||
ln -s "${gogdl}/bin/gogdl" "${legendary-gl}/bin/legendary" "${deps}/public/bin/linux"
|
||||
|
||||
makeWrapper "${electron}/bin/electron" "$out/bin/heroic" \
|
||||
--inherit-argv0 \
|
||||
--add-flags --disable-gpu-compositing \
|
||||
--add-flags "${deps}"
|
||||
|
||||
substituteInPlace "${deps}/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"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Native GUI Epic Games Launcher for Linux, Windows and Mac";
|
||||
description = "A Native GOG and Epic Games Launcher for Linux, Windows and Mac";
|
||||
homepage = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ wolfangaukang ];
|
||||
maintainers = with maintainers; [ aidalgol ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "heroic";
|
||||
};
|
||||
}
|
||||
|
|
109
pkgs/games/heroic/fhsenv.nix
Normal file
109
pkgs/games/heroic/fhsenv.nix
Normal file
|
@ -0,0 +1,109 @@
|
|||
{ lib
|
||||
, buildFHSUserEnv
|
||||
, heroic-unwrapped
|
||||
, extraPkgs ? pkgs: [ ]
|
||||
, extraLibraries ? pkgs: [ ]
|
||||
}:
|
||||
|
||||
buildFHSUserEnv {
|
||||
name = "heroic";
|
||||
|
||||
runScript = "heroic";
|
||||
|
||||
targetPkgs = pkgs: with pkgs; [
|
||||
heroic-unwrapped
|
||||
curl
|
||||
gawk
|
||||
gnome.zenity
|
||||
kdialog
|
||||
mangohud
|
||||
nettools
|
||||
opencl-headers
|
||||
p7zip
|
||||
perl
|
||||
psmisc
|
||||
python3
|
||||
which
|
||||
xorg.xrandr
|
||||
zstd
|
||||
] ++ extraPkgs pkgs;
|
||||
|
||||
multiPkgs = let
|
||||
xorgDeps = pkgs: with pkgs.xorg; [
|
||||
libpthreadstubs
|
||||
libSM
|
||||
libX11
|
||||
libXaw
|
||||
libxcb
|
||||
libXcomposite
|
||||
libXcursor
|
||||
libXdmcp
|
||||
libXext
|
||||
libXi
|
||||
libXinerama
|
||||
libXmu
|
||||
libXrandr
|
||||
libXrender
|
||||
libXv
|
||||
libXxf86vm
|
||||
];
|
||||
in pkgs: with pkgs; [
|
||||
alsa-lib
|
||||
bash
|
||||
cairo
|
||||
coreutils
|
||||
cups
|
||||
dbus
|
||||
freetype
|
||||
fribidi
|
||||
giflib
|
||||
glib
|
||||
gnutls
|
||||
gtk3
|
||||
lcms2
|
||||
libevdev
|
||||
libGLU
|
||||
libglvnd
|
||||
libjpeg
|
||||
libkrb5
|
||||
libmpeg2
|
||||
libogg
|
||||
libopus
|
||||
libpng
|
||||
libpulseaudio
|
||||
libselinux
|
||||
libsndfile
|
||||
libsndfile
|
||||
libtheora
|
||||
libtiff
|
||||
libusb1
|
||||
libv4l
|
||||
libva
|
||||
libvorbis
|
||||
libxkbcommon
|
||||
libxml2
|
||||
mpg123
|
||||
ocl-icd
|
||||
openldap
|
||||
pipewire
|
||||
samba4
|
||||
sane-backends
|
||||
SDL2
|
||||
udev
|
||||
udev
|
||||
unixODBC
|
||||
util-linux
|
||||
vulkan-loader
|
||||
wayland
|
||||
zlib
|
||||
] ++ xorgDeps pkgs
|
||||
++ extraLibraries pkgs;
|
||||
|
||||
extraInstallCommands = ''
|
||||
mkdir -p $out/share
|
||||
ln -s ${heroic-unwrapped}/share/applications $out/share
|
||||
ln -s ${heroic-unwrapped}/share/icons $out/share
|
||||
'';
|
||||
|
||||
meta = heroic-unwrapped.meta;
|
||||
}
|
244
pkgs/games/heroic/package.json
Normal file
244
pkgs/games/heroic/package.json
Normal file
|
@ -0,0 +1,244 @@
|
|||
{
|
||||
"name": "heroic",
|
||||
"version": "2.4.0",
|
||||
"private": true,
|
||||
"main": "public/main.js",
|
||||
"homepage": "./",
|
||||
"license": "GPL-3.0-only",
|
||||
"description": "An Open Source Launcher for GOG and Epic Games",
|
||||
"repository": {
|
||||
"type": "Github",
|
||||
"url": "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher"
|
||||
},
|
||||
"author": {
|
||||
"name": "Heroic Games Launcher",
|
||||
"email": "heroicgameslauncher@protonmail.com"
|
||||
},
|
||||
"build": {
|
||||
"appId": "com.electron.heroic",
|
||||
"productName": "Heroic",
|
||||
"files": [
|
||||
"build/**/*",
|
||||
"node_modules/**/*",
|
||||
"!build/bin/*",
|
||||
"build/bin/legendary.LICENSE"
|
||||
],
|
||||
"asarUnpack": [
|
||||
"build/icon.png",
|
||||
"build/icon.icns",
|
||||
"build/win_icon.ico",
|
||||
"build/icon-dark.png",
|
||||
"build/icon-light.png"
|
||||
],
|
||||
"directories": {
|
||||
"buildResources": "public"
|
||||
},
|
||||
"protocols": [
|
||||
{
|
||||
"name": "heroic",
|
||||
"schemes": [
|
||||
"heroic"
|
||||
]
|
||||
}
|
||||
],
|
||||
"win": {
|
||||
"artifactName": "Heroic_Setup_${version}.${ext}",
|
||||
"icon": "build/win_icon.ico",
|
||||
"asarUnpack": [
|
||||
"build/bin/win32/legendary.exe",
|
||||
"build/bin/win32/gogdl.exe"
|
||||
],
|
||||
"files": [
|
||||
"build/bin/win32/*"
|
||||
]
|
||||
},
|
||||
"mac": {
|
||||
"target": "dmg",
|
||||
"category": "public.app-category.games",
|
||||
"icon": "build/icon.icns",
|
||||
"asarUnpack": [
|
||||
"build/bin/darwin/legendary",
|
||||
"build/bin/darwin/gogdl"
|
||||
],
|
||||
"files": [
|
||||
"build/bin/darwin/*"
|
||||
]
|
||||
},
|
||||
"dmg": {
|
||||
"background": "public/dmg.png",
|
||||
"window": {
|
||||
"width": "600",
|
||||
"height": "500"
|
||||
},
|
||||
"contents": [
|
||||
{
|
||||
"x": 10,
|
||||
"y": 215,
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"x": 420,
|
||||
"y": 215,
|
||||
"type": "link",
|
||||
"path": "/Applications"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"category": "Game",
|
||||
"icon": "build/icon.icns",
|
||||
"description": "An Open Source Launcher for GOG and Epic Games",
|
||||
"desktop": {
|
||||
"Name": "Heroic Games Launcher",
|
||||
"Comment[de]": "Ein Open Source Spielelauncher for GOG und Epic Games"
|
||||
},
|
||||
"asarUnpack": [
|
||||
"build/bin/linux/legendary",
|
||||
"build/bin/linux/gogdl"
|
||||
],
|
||||
"files": [
|
||||
"build/bin/linux/*"
|
||||
]
|
||||
},
|
||||
"deb": {
|
||||
"packageCategory": "games",
|
||||
"depends": [
|
||||
"gawk",
|
||||
"curl"
|
||||
]
|
||||
},
|
||||
"pacman": {
|
||||
"packageCategory": "games",
|
||||
"depends": [
|
||||
"gawk",
|
||||
"curl"
|
||||
]
|
||||
},
|
||||
"rpm": {
|
||||
"packageCategory": "games",
|
||||
"depends": [
|
||||
"gawk",
|
||||
"curl"
|
||||
]
|
||||
}
|
||||
},
|
||||
"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.6.2",
|
||||
"@mui/material": "^5.6.2",
|
||||
"@node-steam/vdf": "^2.2.0",
|
||||
"axios": "^0.26.1",
|
||||
"check-disk-space": "^3.3.1",
|
||||
"classnames": "^2.3.1",
|
||||
"crc": "^4.1.1",
|
||||
"discord-rich-presence-typescript": "^0.0.8",
|
||||
"electron-store": "^8.0.1",
|
||||
"electron-updater": "^5.0.1",
|
||||
"filesize": "^8.0.7",
|
||||
"font-list": "^1.4.5",
|
||||
"fs-extra": "^10.1.0",
|
||||
"fuse.js": "^6.6.2",
|
||||
"graceful-fs": "^4.2.10",
|
||||
"heroic-wine-downloader": "^1.2.3",
|
||||
"i18next": "^21.6.16",
|
||||
"i18next-fs-backend": "^1.1.4",
|
||||
"i18next-http-backend": "^1.4.0",
|
||||
"ini": "^3.0.0",
|
||||
"plist": "^3.0.5",
|
||||
"react": "17",
|
||||
"react-dom": "17",
|
||||
"react-i18next": "^11.16.7",
|
||||
"react-router-dom": "^6.3.0",
|
||||
"react-scripts": "^5.0.1",
|
||||
"shlex": "^2.1.2",
|
||||
"simple-keyboard": "^3.4.136",
|
||||
"source-map-support": "^0.5.21",
|
||||
"steam-shortcut-editor": "^3.1.1",
|
||||
"systeminformation": "^5.12.3",
|
||||
"tslib": "^2.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "DISABLE_ESLINT_PLUGIN=true nf start -p 3000 && electron-start",
|
||||
"electron-start": "ELECTRON_IS_DEV=1 node public/start-react",
|
||||
"electron": "yarn build-electron && electron . --trace-warnings",
|
||||
"react-start": "HOST=localhost BROWSER=none react-scripts start",
|
||||
"react-start:win": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "jest --noStackTrace",
|
||||
"test-watch": "jest --watch --maxWorkers=25%",
|
||||
"test:ci": "jest --runInBand --silent",
|
||||
"eject": "react-scripts eject",
|
||||
"release:linux": "GH_TOKEN='${{ secrets.WORKFLOW_TOKEN }}' yarn build-electron && yarn build && electron-builder -c.extraMetadata.main=build/main.js -p always --linux deb AppImage rpm pacman tar.xz",
|
||||
"release:mac": "GH_TOKEN='${{ secrets.WORKFLOW_TOKEN }}' yarn build-electron && yarn build && electron-builder -c.extraMetadata.main=build/main.js -p always --mac",
|
||||
"release:win": "yarn build-electron && yarn build && electron-builder -c.extraMetadata.main=build/main.js -p always --win nsis portable",
|
||||
"dist:linux": "GH_TOKEN='${{ secrets.WORKFLOW_TOKEN }}' yarn build-electron && yarn build && electron-builder -c.extraMetadata.main=build/main.js --linux",
|
||||
"dist:mac": "GH_TOKEN='${{ secrets.WORKFLOW_TOKEN }}' yarn build-electron && yarn build && electron-builder -c.extraMetadata.main=build/main.js --mac",
|
||||
"dist:win": "yarn build-electron && yarn build && electron-builder -c.extraMetadata.main=build/main.js --win",
|
||||
"lint": "eslint -c .eslintrc --ext .tsx,ts ./src && eslint -c .eslintrc --ext .ts ./electron",
|
||||
"lint-fix": "eslint --fix -c .eslintrc --ext .tsx,ts ./src && eslint --fix -c .eslintrc --ext .ts ./electron",
|
||||
"build-electron": "tsc --project electron/tsconfig.json",
|
||||
"watch-electron": "tsc --watch --project electron/tsconfig.json",
|
||||
"dist-flatpak": "cd flatpak && flatpak-builder build local.heroic.yml --install --force-clean --user",
|
||||
"flatpak-test": "yarn dist:linux appimage && cd flatpak && flatpak-builder build local.heroic.yml --install --force-clean --user",
|
||||
"i18n": "i18next",
|
||||
"prepare": "husky install",
|
||||
"prettier": "prettier --check .",
|
||||
"prettier-fix": "prettier --write ."
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/dom": "^7.31.0",
|
||||
"@testing-library/jest-dom": "^5.16.4",
|
||||
"@testing-library/react": "^13.1.1",
|
||||
"@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/plist": "^3.0.2",
|
||||
"@types/react": "^18.0.6",
|
||||
"@types/react-dom": "^18.0.2",
|
||||
"@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",
|
||||
"electron": "^20.0.1",
|
||||
"electron-builder": "^23.1.0",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"eslint": "^8.13.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-react": "^7.29.4",
|
||||
"foreman": "^3.0.1",
|
||||
"husky": "^7.0.4",
|
||||
"i18next-parser": "^6.3.0",
|
||||
"prettier": "^2.6.2",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"tmp": "^0.2.1",
|
||||
"ts-jest": "^27.1.4",
|
||||
"typescript": "^4.6.3"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version"
|
||||
]
|
||||
}
|
||||
}
|
11716
pkgs/games/heroic/yarn.lock
Normal file
11716
pkgs/games/heroic/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
12317
pkgs/games/heroic/yarn.nix
Normal file
12317
pkgs/games/heroic/yarn.nix
Normal file
File diff suppressed because it is too large
Load diff
|
@ -33147,7 +33147,11 @@ with pkgs;
|
|||
|
||||
gotypist = callPackage ../games/gotypist { };
|
||||
|
||||
heroic = callPackage ../games/heroic { };
|
||||
heroic-unwrapped = callPackage ../games/heroic { };
|
||||
|
||||
heroic = callPackage ../games/heroic/fhsenv.nix {
|
||||
buildFHSUserEnv = buildFHSUserEnvBubblewrap;
|
||||
};
|
||||
|
||||
julius = callPackage ../games/julius { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue