2024-06-24 03:02:36 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
unzip,
|
|
|
|
meson,
|
|
|
|
ninja,
|
|
|
|
pkg-config,
|
|
|
|
qtbase,
|
|
|
|
qttools,
|
|
|
|
wrapQtAppsHook,
|
|
|
|
icoutils,
|
|
|
|
copyDesktopItems,
|
|
|
|
makeDesktopItem,
|
|
|
|
luajit,
|
|
|
|
}:
|
2023-04-09 08:33:15 +00:00
|
|
|
let
|
2024-06-24 03:02:36 +00:00
|
|
|
data = stdenv.mkDerivation (finalAttrs: {
|
2023-08-16 08:06:14 +00:00
|
|
|
pname = "path-of-building-data";
|
2024-03-30 06:15:12 +00:00
|
|
|
version = "2.42.0";
|
2023-04-09 08:33:15 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "PathOfBuildingCommunity";
|
|
|
|
repo = "PathOfBuilding";
|
2023-08-16 08:06:14 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-03-30 06:15:12 +00:00
|
|
|
hash = "sha256-OxAyB+tMszQktGvxlGL/kc+Wt0iInFYY0qHNjK6EnSg=";
|
2023-04-09 08:33:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
|
2023-08-16 08:06:14 +00:00
|
|
|
buildCommand = ''
|
|
|
|
# I have absolutely no idea how this file is generated
|
|
|
|
# and I don't think I want to know. The Flatpak also does this.
|
|
|
|
unzip -j -d $out $src/runtime-win32.zip lua/sha1.lua
|
2023-04-09 08:33:15 +00:00
|
|
|
|
2023-08-16 08:06:14 +00:00
|
|
|
# Install the actual data
|
|
|
|
cp -r $src/src $src/runtime/lua/*.lua $src/manifest.xml $out
|
2023-04-09 08:33:15 +00:00
|
|
|
|
2023-08-16 08:06:14 +00:00
|
|
|
# Pretend this is an official build so we don't get the ugly "dev mode" warning
|
|
|
|
substituteInPlace $out/manifest.xml --replace '<Version' '<Version platform="nixos"'
|
|
|
|
touch $out/installed.cfg
|
|
|
|
|
|
|
|
# Completely stub out the update check
|
|
|
|
chmod +w $out/src/UpdateCheck.lua
|
|
|
|
echo 'return "none"' > $out/src/UpdateCheck.lua
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "path-of-building";
|
|
|
|
version = "${data.version}-unstable-2023-04-09";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ernstp";
|
|
|
|
repo = "pobfrontend";
|
|
|
|
rev = "9faa19aa362f975737169824c1578d5011487c18";
|
|
|
|
hash = "sha256-zhw2PZ6ZNMgZ2hG+a6AcYBkeg7kbBHNc2eSt4if17Wk=";
|
|
|
|
};
|
2023-04-09 08:33:15 +00:00
|
|
|
|
2024-06-24 03:02:36 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
qttools
|
|
|
|
wrapQtAppsHook
|
|
|
|
icoutils
|
|
|
|
] ++ lib.optional stdenv.isLinux copyDesktopItems;
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
qtbase
|
|
|
|
luajit
|
|
|
|
luajit.pkgs.lua-curl
|
|
|
|
];
|
2023-04-09 08:33:15 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
install -Dm555 pobfrontend $out/bin/pobfrontend
|
2024-06-24 03:02:36 +00:00
|
|
|
|
|
|
|
wrestool -x -t 14 ${data.src}/runtime/Path{space}of{space}Building.exe -o pathofbuilding.ico
|
|
|
|
icotool -x pathofbuilding.ico
|
|
|
|
|
|
|
|
for size in 16 32 48 256; do
|
|
|
|
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
|
|
|
|
install -Dm 644 pathofbuilding*"$size"x"$size"*.png \
|
|
|
|
$out/share/icons/hicolor/"$size"x"$size"/apps/pathofbuilding.png
|
|
|
|
done
|
|
|
|
rm pathofbuilding.ico
|
|
|
|
|
2023-04-09 08:33:15 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2023-08-16 08:06:14 +00:00
|
|
|
preFixup = ''
|
|
|
|
qtWrapperArgs+=(
|
|
|
|
--set LUA_PATH "$LUA_PATH"
|
|
|
|
--set LUA_CPATH "$LUA_CPATH"
|
|
|
|
--chdir "${data}"
|
|
|
|
)
|
2023-04-09 08:33:15 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-24 03:02:36 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "path-of-building";
|
|
|
|
desktopName = "Path of Building";
|
|
|
|
comment = "Offline build planner for Path of Exile";
|
|
|
|
exec = "pobfrontend %U";
|
|
|
|
terminal = false;
|
|
|
|
type = "Application";
|
|
|
|
icon = "pathofbuilding";
|
|
|
|
categories = [ "Game" ];
|
|
|
|
keywords = [
|
|
|
|
"poe"
|
|
|
|
"pob"
|
|
|
|
"pobc"
|
|
|
|
"path"
|
|
|
|
"exile"
|
|
|
|
];
|
|
|
|
mimeTypes = [ "x-scheme-handler/pob" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-08-16 08:06:14 +00:00
|
|
|
passthru.data = data;
|
|
|
|
|
2023-04-09 08:33:15 +00:00
|
|
|
meta = {
|
|
|
|
description = "Offline build planner for Path of Exile";
|
|
|
|
homepage = "https://pathofbuilding.community/";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.k900 ];
|
|
|
|
mainProgram = "pobfrontend";
|
2024-06-24 03:02:36 +00:00
|
|
|
broken = stdenv.isDarwin; # doesn't find uic6 for some reason
|
2023-04-09 08:33:15 +00:00
|
|
|
};
|
|
|
|
}
|