1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
{
stdenv,
lib,
fetchFromGitHub,
unzip,
meson,
ninja,
pkg-config,
qtbase,
qttools,
wrapQtAppsHook,
icoutils,
copyDesktopItems,
makeDesktopItem,
luajit,
}:
let
data = stdenv.mkDerivation (finalAttrs: {
pname = "path-of-building-data";
version = "2.46.0";
src = fetchFromGitHub {
owner = "PathOfBuildingCommunity";
repo = "PathOfBuilding";
rev = "v${finalAttrs.version}";
hash = "sha256-L63pFaIjSDEzEud+v4IbNjFVdwTBU08/xICBIHzPutE=";
};
nativeBuildInputs = [ unzip ];
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
# Install the actual data
cp -r $src/src $src/runtime/lua/*.lua $src/manifest.xml $out
# 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=";
};
nativeBuildInputs = [
meson
ninja
pkg-config
qttools
wrapQtAppsHook
icoutils
] ++ lib.optional stdenv.isLinux copyDesktopItems;
buildInputs = [
qtbase
luajit
luajit.pkgs.lua-curl
];
installPhase = ''
runHook preInstall
install -Dm555 pobfrontend $out/bin/pobfrontend
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
runHook postInstall
'';
preFixup = ''
qtWrapperArgs+=(
--set LUA_PATH "$LUA_PATH"
--set LUA_CPATH "$LUA_CPATH"
--chdir "${data}"
)
'';
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" ];
})
];
passthru.data = data;
meta = {
description = "Offline build planner for Path of Exile";
homepage = "https://pathofbuilding.community/";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.k900 ];
mainProgram = "pobfrontend";
broken = stdenv.isDarwin; # doesn't find uic6 for some reason
};
}
|