nixpkgs/pkgs/games/heroic/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
2.0 KiB
Nix
Raw Normal View History

{ lib
, mkYarnPackage
, fetchFromGitHub
, makeWrapper
, electron
, gogdl
, legendary-gl
}:
mkYarnPackage rec {
pname = "heroic-unwrapped";
version = "2.4.3";
src = fetchFromGitHub {
owner = "Heroic-Games-Launcher";
repo = "HeroicGamesLauncher";
rev = "v${version}";
sha256 = "sha256-x9zIM2kKi+JgIGIidQYjyjqVGweFJ8DE7IX9gYULQuQ=";
2021-12-03 20:57:34 +00:00
};
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
nativeBuildInputs = [
makeWrapper
];
2021-12-03 20:57:34 +00:00
DISABLE_ESLINT_PLUGIN = "true";
postBuild = let
yarnCmd = "yarn --production --offline --frozen-lockfile --ignore-engines --ignore-scripts --lockfile ${yarnLock}";
in ''
${yarnCmd} build-electron
${yarnCmd} build
'';
2021-12-03 20:57:34 +00:00
# Disable bundling into a tar archive.
doDist = false;
2021-12-03 20:57:34 +00:00
# --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"
2021-12-03 20:57:34 +00:00
makeWrapper "${electron}/bin/electron" "$out/bin/heroic" \
--inherit-argv0 \
--add-flags --disable-gpu-compositing \
--add-flags "${deps}"
2021-12-03 20:57:34 +00:00
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"
2021-12-03 20:57:34 +00:00
'';
meta = with lib; {
description = "A Native GOG and Epic Games Launcher for Linux, Windows and Mac";
2021-12-03 20:57:34 +00:00
homepage = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher";
license = licenses.gpl3Only;
maintainers = with maintainers; [ aidalgol ];
2021-12-03 20:57:34 +00:00
platforms = [ "x86_64-linux" ];
mainProgram = "heroic";
2021-12-03 20:57:34 +00:00
};
}