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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
{
lib,
stdenv,
fetchgit,
fetchFromGitHub,
cmake,
openssl,
qt6,
zlib-ng,
bzip2,
xz,
zstd,
cryptopp,
pkg-config,
makeWrapper,
versionCheckHook,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "vpkedit";
version = "5.0.0-beta.1";
# FIXME: when updating, see if versions match again & we can get rid of this.
# pls dont let it last longer than it needs to kthx
passthru.tmpVerMismatch =
assert finalAttrs.version == "5.0.0-beta.1";
"5.0.0.1";
src = fetchFromGitHub {
owner = "craftablescience";
repo = finalAttrs.pname;
tag = "v${finalAttrs.passthru.tmpVerMismatch}";
fetchSubmodules = true;
hash = "sha256-CPL+pPVrkbTIktskRsgHHgarg4edf0s3U2pnJ5/6h8E=";
};
/*
The following sources should be updated to what was available at the time of
VPKEdit's release, according to the vendored submodules and their nested
submodules. These need to exist to avoid CMake's FetchContent trying to
pull stuff over the network.
v5.0.0.1
- src/thirdparty/sourcepp @ 6ba306ad
- ext/cryptopp (which is actually cryptopp-cmake) @ gedb9a71
- sources cryptopp (the actual one) from latest release tag of
https://github.com/weidai11/cryptopp
- ext/minizip-ng @ heads/develop
which at time of v5.0.0.1 commit was 2c0dc5d8
- sources zlib from stable branch of https://github.com/zlib-ng/zlib-ng
(pinned to latest release tag)
- sources bzip2 from master branch of https://gitlab.com/bzip2/bzip2
(seemingly assuming
- sources xz from master branch of https://github.com/tukaani-project/xz
- sources zstd from release branch of https://github.com/facebook/zstd
(pinned to latest release tag)
*/
cryptopp-src = fetchgit {
url = "https://github.com/weidai11/cryptopp";
tag = "CRYPTOPP_8_9_0";
hash = "sha256-HV+afSFkiXdy840JbHBTR8lLL0GMwsN3QdwaoQmicpQ=";
};
zlib-src = fetchgit {
url = "https://github.com/zlib-ng/zlib-ng";
tag = "2.2.5";
hash = "sha256-VB4aegnZCZut9H/Hu2PBwwldpbM7E67D5QFYCKgq3mg=";
};
bzip2-src = fetchgit {
url = "https://gitlab.com/bzip2/bzip2";
rev = "66c46b8c9436613fd81bc5d03f63a61933a4dcc3";
hash = "sha256-JuwmLBwtUPW9Wt31wIX5NMCu0VTxt16XaBQ2c5rFTY4=";
};
xz-src = fetchgit {
url = "https://github.com/tukaani-project/xz";
tag = "v5.8.1";
hash = "sha256-29w1K3zC58oFkBvSdwpKu694S+42FxzqOtWBpS7iJ+A=";
};
zstd-src = fetchgit {
url = "https://github.com/facebook/zstd";
tag = "v1.5.7";
hash = "sha256-tNFWIT9ydfozB8dWcmTMuZLCQmQudTFJIkSr0aG7S44=";
};
nativeBuildInputs = [
cmake
makeWrapper
qt6.wrapQtAppsHook
];
buildInputs = [
bzip2
cryptopp
openssl
pkg-config
qt6.qtbase
qt6.qttools
xz
zlib-ng
zstd
];
cmakeFlags = with finalAttrs; [
(lib.cmakeFeature "CRYPTOPP_SOURCES" "${cryptopp-src}")
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ZLIB" "${zlib-src}")
# it wants write access now. wowee.
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_BZIP2" "/build/bzip2tmp")
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_LIBLZMA" "${xz-src}")
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ZSTD" "${zstd-src}")
(lib.cmakeFeature "CPACK_GENERATOR" "DEB")
(lib.cmakeBool "MZ_OPENSSL" true)
];
patches = [
./0001-nix-translation-base-fixup.patch
./fix-miniz-cmake-dirs.patch
];
postInstall = ''
mkdir -p $out/lib/vpkedit/i18n
mv *.qm $out/lib/vpkedit/i18n
'';
postUnpack = ''
cp -r ${finalAttrs.bzip2-src} /build/bzip2tmp
chmod -R +w /build/bzip2tmp
'';
# doesnt seem to make any real difference but it complained and i listened
LANG = "C.UTF-8";
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgram = "${placeholder "out"}/bin/vpkeditcli";
doInstallCheck = true;
meta = {
description = "CLI/GUI tool to create, read, and write several pack file formats";
homepage = "https://github.com/craftablescience/VPKEdit";
mainProgram = "vpkeditcli";
license = lib.licenses.mit;
platforms = [ "x86_64-linux" ];
changelog = "https://github.com/craftablescience/VPKEdit/releases/tag/v${finalAttrs.passthru.tmpVerMismatch}";
};
})
|