17 stdenv.mkDerivation (finalAttrs: {
18 pname = "heroic-unwrapped";
21 src = fetchFromGitHub {
22 owner = "Heroic-Games-Launcher";
23 repo = "HeroicGamesLauncher";
24 rev = "v${finalAttrs.version}";
25 hash = "sha256-AndJqk1VAUdC4pOTRzyfhdxmzJMskGF6pUiqPs3fIy4=";
28 pnpmDeps = pnpm.fetchDeps {
29 inherit (finalAttrs) pname version src;
30 hash = "sha256-/7JIeQZt3QsKrjujSucRLiHfhfSllK7FeumNA4eHqSY=";
40 # Make Heroic create Steam shortcuts (to non-steam games) with the correct path to heroic.
41 ./fix-non-steam-shortcuts.patch
45 # We are not packaging this as an Electron application bundle, so Electron
46 # reports to the application that is is not "packaged", which causes Heroic
47 # to take some incorrect codepaths meant for development environments.
48 substituteInPlace src/**/*.ts --replace-quiet 'app.isPackaged' 'true'
54 pnpm --offline electron-vite build
55 # Remove dev dependencies.
56 pnpm --ignore-scripts prune --prod
57 # Clean up broken symlinks left behind by `pnpm prune`
58 find node_modules/.bin -xtype l -delete
63 # --disable-gpu-compositing is to work around upstream bug
64 # https://github.com/electron/electron/issues/32317
68 mkdir -p $out/share/{applications,heroic}
69 cp -r . $out/share/heroic
70 rm -rf $out/share/heroic/{.devcontainer,.vscode,.husky,.idea,.github}
72 chmod -R u+w "$out/share/heroic/public/bin" "$out/share/heroic/build/bin"
73 rm -rf "$out/share/heroic/public/bin" "$out/share/heroic/build/bin"
74 mkdir -p "$out/share/heroic/build/bin/x64/linux"
76 "${lib.getExe gogdl}" \
77 "${lib.getExe legendary-gl}" \
78 "${lib.getExe nile}" \
79 "${lib.getExe comet-gog}" \
80 "${lib.getExe vulkan-helper}" \
81 "$out/share/heroic/build/bin/x64/linux/"
83 makeWrapper "${electron}/bin/electron" "$out/bin/heroic" \
85 --add-flags --disable-gpu-compositing \
86 --add-flags $out/share/heroic \
87 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime}}"
89 substituteInPlace "$out/share/heroic/flatpak/com.heroicgameslauncher.hgl.desktop" \
90 --replace-fail "Exec=heroic-run" "Exec=heroic"
91 mkdir -p "$out/share/applications" "$out/share/icons/hicolor/scalable/apps"
92 ln -s "$out/share/heroic/flatpak/com.heroicgameslauncher.hgl.desktop" "$out/share/applications"
93 ln -s "$out/share/heroic/src/frontend/assets/heroic-icon.svg" "$out/share/icons/hicolor/scalable/apps/com.heroicgameslauncher.hgl.svg"
99 inherit (finalAttrs) pnpmDeps;
100 updateScript = nix-update-script { };
104 description = "Native GOG, Epic, and Amazon Games Launcher for Linux, Windows and Mac";
105 homepage = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher";
106 changelog = "https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases";
107 license = licenses.gpl3Only;
108 maintainers = with maintainers; [ aidalgol ];
109 # Heroic may work on nix-darwin, but it needs a dedicated maintainer for the platform.
110 # It may also work on other Linux targets, but all the game stores only
111 # support x86 Linux, so it would require extra hacking to run games via QEMU
112 # user emulation. Upstream provide Linux builds only for x86_64.
113 platforms = [ "x86_64-linux" ];
114 mainProgram = "heroic";