139 lines
3.2 KiB
Nix
139 lines
3.2 KiB
Nix
|
{
|
||
|
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";
|
||
|
};
|
||
|
})
|