Add awakened-poe-trade

This commit is contained in:
Torjus Håkestad 2024-07-20 19:43:23 +02:00
parent 1cab9b2773
commit e717dfc32b
2 changed files with 140 additions and 0 deletions

View File

@ -2,6 +2,7 @@
let
withCuda = if (osConfig.system.name == "gunter") then true else false;
pob = pkgs.qt6Packages.callPackage ../../packages/pob.nix { };
awakened-poe-trade = pkgs.callPackage ../../packages/awakened-poe-trade.nix { };
in
{
home.packages = with pkgs; [
@ -106,5 +107,6 @@ in
(prismlauncher.override { withWaylandGLFW = true; })
pob
awakened-poe-trade
];
}

View File

@ -0,0 +1,138 @@
{
stdenv,
lib,
fetchFromGitHub,
fetchYarnDeps,
yarn,
yarnConfigHook,
yarnBuildHook,
makeWrapper,
libGL,
nodejs,
electron,
xorg,
wayland,
libglvnd,
npmHooks,
}:
let
pkgVersion = "3.24.10004";
pkgSrc = fetchFromGitHub {
owner = "SnosMe";
repo = "awakened-poe-trade";
rev = "v${pkgVersion}";
hash = "sha256-khIJIOT5Us792YThruNZfnpfBrcPS/vjoAdLI6V4Nwo=";
};
yarnCacheRenderer = fetchYarnDeps {
yarnLock = pkgSrc + "/renderer/yarn.lock";
hash = "sha256-hOfE8XCu1Y4yZzOKHhaNkqKxJ6gxZS5SLRlBxvq3LwY=";
};
yarnCacheMain = fetchYarnDeps {
yarnLock = pkgSrc + "/main/yarn.lock";
hash = "sha256-VLDsqCKrNF7Smywg3yRrjgMG0lmZt8uzeTHKr5n2JMw=";
};
renderer = stdenv.mkDerivation (finalAttrs: {
pname = "awakened-poe-trade-renderer";
version = "${pkgVersion}";
src = pkgSrc;
sourceRoot = "${finalAttrs.src.name}/renderer";
yarnOfflineCache = yarnCacheRenderer;
buildPhase = ''
yarn make-index-files
runHook yarnBuildHook
'';
installPhase = ''
mkdir -p $out
cp -r dist $out;
'';
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
nodejs
];
});
in
stdenv.mkDerivation (finalAttrs: {
pname = "awakened-poe-trade";
version = "${pkgVersion}";
src = pkgSrc;
sourceRoot = "${finalAttrs.src.name}/main";
yarnOfflineCache = yarnCacheMain;
patchPhase = ''
find .
substituteInPlace electron-builder.yml \
--replace-fail "../renderer/dist" "${renderer}/dist" \
--replace-fail "AppImage" "dir"
cat electron-builder.yml
find "${renderer}"
'';
env = {
ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
ELECTRON_OVERRIDE_DIST_PATH = "${electron}";
};
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
yarn
nodejs
electron
makeWrapper
renderer
];
# yarnBuildScript = "electron-builder";
# yarnBuildFlags = [
# "--dir"
# "-c.electronDist=${electron}/libexec/electron"
# "-c.electronVersion=${electron.version}"
# ];
buildPhase = ''
runHook yarnBuildHook
yarn run electron-builder --dir -c.electronDist=${electron}/libexec/electron -c.electronVersion=${electron.version}
find dist
'';
installPhase = ''
runHook preInstall
mkdir -p "$out/share/lib/awakened-poe-trade"
cp -r ./dist/*-unpacked/{locales,resources{,.pak}} "$out/share/lib/awakened-poe-trade"
cp -r "${renderer}/dist/data" "$out/share/lib/awakened-poe-trade/resources/data"
echo "${renderer}"
makeWrapper '${electron}/bin/electron' "$out/bin/awakened-poe-trade" \
--set LD_LIBRARY_PATH "${
lib.makeLibraryPath [
libGL
xorg.libXtst
xorg.libXt
wayland
libglvnd
]
}" \
--add-flags "$out/share/lib/awakened-poe-trade/resources/app.asar" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--inherit-argv0
runHook postInstall
'';
buildInputs = [ electron ];
meta = {
description = "Path of Exile trading app for price checking";
homepage = "https://github.com/SnosMe/awakened-poe-trade";
license = lib.licenses.mit;
mainProgram = "pobfrontend";
};
})